Page 1 of 1

RegEx Senior Moment --- :-)

Posted: Wed Apr 11, 2007 3:13 pm
by contiw
Please help with a RegEx validate :

Just alpha nocase,
apostrophe and dash ok,
no double spaces,
one comma required.

Thank you very much

Posted: Wed Apr 11, 2007 3:23 pm
by feyd
What have you tried?

Posted: Wed Apr 11, 2007 3:37 pm
by contiw
[^a-z\-\,\']|(\,.*\,)

I have difficulties with the "double space" though.

Posted: Wed Apr 11, 2007 3:46 pm
by feyd
You could simply replace multiple spaces with a single space.

Posted: Wed Apr 11, 2007 3:50 pm
by contiw
Thanks Most Helpful Fade! :-)
I will replace the double space before regex validate.
contiW

Posted: Wed Apr 11, 2007 7:26 pm
by nickvd
unless more than two spaces is allowed, remember to replace 2+ spaces with a single one..

Posted: Wed Apr 11, 2007 8:35 pm
by contiw
Thanks nickvd.
contiW