I'm trying to learn javascript Regex and I've hit a problem.
I'm trying to validate with the following rules.
Allow only:
Numbers 0-9
(
)
+
-
(space)
I have come up with the regex below to handle this:
/[0-9\)\(\+\- ]+/i
The following matches but shouldn't do because it contains a @ symbol:
+0@122 0012
I'm using the below to test: (Returns true)
/[0-9\)\(\+\- ]+/i.test("+0@122 0012")
Thanks.
^and$.