You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The matches validator uses RegExp#test(), which means you CANNOT pass global regular expressions, or the validator will not work as expected.
Example:
varre=/^[a-zA-Z0-9_-]+$/gi;// note the "g" for global (not to mention the redundant "i")varstr='one';re.test(str);// truere.test(str);// falsere.test(str);// truere.test(str);// falsere.test(str);// truere.test(str);// falsere.test(str);// truere.test(str);// falsere.test(str);// truere.test(str);// falsere.test(str);// truere.test(str);// false
The text was updated successfully, but these errors were encountered:
Yeah. If you don't reuse the regex (which is our usual m.o.), it doesn't come up. But here, the whole point is to reuse the same regex object. Good times.
The
matches
validator uses RegExp#test(), which means you CANNOT pass global regular expressions, or the validator will not work as expected.Example:
The text was updated successfully, but these errors were encountered: