Reputation: 873
I am trying to use regulare expressions with a formvalidator.net to validate a form but I am struggling to under stand regular expressions,I have had a look at some websites but it is still baffling.
Basically I want to validate a field so that when a user enter something it will chack that the word or entry doesnt contain certain characters. So for example I don't want '!name' or 'this ! name' to be accepted.
using regexp for testing I have created this expression ([a-zA-Z\+\&\,\.\-\(\)\d][^<>%$!]+)
which excludes those characters but in my form validator it will still accept '!name' or 'this ! name'
Can anyone point me in the right direction? I feel like I'm typing stuff in and gettign nowhere.
Ian
Upvotes: 2
Views: 39
Reputation: 1484
Basically I think you want to either decide what characters you don't want OR what characters you do. Not both.
I think this is what your after:
^[^<>%$!]+$
Upvotes: 1