I want to check if a string ends with ab followed by an integer.
Given any string s, how can I first check if it ends with ab1 or ab2 or ab3, and if so, return ab1 or ab2 or ab3.
For example, for string sdfsadfsab2, I want to return ab2.
For string asdfase I want to return empty string.
Is there any regular expression in javascript or jquery can do this? thanks.