Menu
Hi everyone!
I have an array which stores a regular expression as a string. Example:
[code]var myVar = new Array(“^((?[0-9]{3}[)-. ]? ?)?[0-9]{3}[-. ]?[0-9]{4}$”);
var thisRegExp = new RegExp(myVar[0]);
I continuously get this error:
[code]invalid quantifier
However, If i do this:
[code]var thisRegExp = /^((?[0-9]{3}[)-. ]? ?)?[0-9]{3}[-. ]?[0-9]{4}$/;
if(thisRegExp.test(the_value)){..
Everything works fine. How can I get this to work?