I am trying to learn Javascript Regex and I ran into a problem.
I am trying to verify using the following rules.
Allow only:
Numbers 0-9 ( ) + - (space)
I came up with the following expression:
/[0-9\)\(\+\- ]+/i
The following matches, but should not, because they contain the @ character:
+0@122 0012
I use below to check: (returns true)
/[0-9\)\(\+\- ]+/i.test(" +0@122 0012")
Thanks.
source share