PDA

View Full Version : help with reg expression



wo1olf
August 29th, 2007, 06:25 PM
Here is the reg expression i'm using to validate a field form.
"^[-a-z ,é,ç,è,à,â,ê]+$"
I want it also to include the character " ' "
How can i do that ?

MTsoul
August 29th, 2007, 06:41 PM
"^[-a-z ,é,ç,è,à,â,ê']+$"

wo1olf
August 29th, 2007, 07:50 PM
"^[-a-z ,é,ç,è,à,â,ê']+$"
it do not work, i try even adding a , before but still not working

BradLee
August 29th, 2007, 08:05 PM
You don't need to put a comma between letters/numbers/whatever inside character classes in regular expressions.

Like this:

/^[-a-z éçèàâê']+$/

Also, that should match '. If it doesn't then something else is wrong. Try using an online regular expression checker like http://www.nvcc.edu/home/drodgers/ceu/resources/test_regexp.asp
(First one that come up on google)