I have this regex on Javascript
var myS = "00 - ??:??:?? - a";
var removedTL = myS.match(/^(\d\d) - (\?\?|10|0\d):(\?\?|[0-5]\d):(\?\?|[0-5]\d) - (.*)/);
and I need to return “false” if myS is not in that format, true otherwise.
I mean :
var myS = "00 - ??:??:?? - a"; // TRUE
var myS = "00 - ??:?:?? - a"; // FALSE
how can I check if the regex has matched the string or not?
The
matchmethod will returnnullif there is no match.