Reputation: 35
I am using this regex for validating numbers and specific set of special character.
([0-9]+[ \(\)-/#]*)$
This does not restrict special characters as specified. What is the problem with my regex.
thanks..
Upvotes: 1
Views: 122
Reputation: 785038
Make sure to use start anchor ^
and avoid unnecessary escaping inside character class:
^([0-9]+[ ()/#-]*)$
Upvotes: 1