Below I am trying to use regex to get the occurrence of certain strings.
var value = "ab-2123 AB-332";
// "i" is for case insensitive
var regExp = new RegExp("(ab)[-][0-9]*", "gi");
var searchedString = regExp.exec(value);
console.log(searchedString);
This only detects ab-2124
but not AB-33
. Could some one please help me to figure out the mistake?