RegEx Senior Moment --- :-)

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
contiw
Forum Newbie
Posts: 6
Joined: Wed Apr 11, 2007 3:05 pm

RegEx Senior Moment --- :-)

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What have you tried?
contiw
Forum Newbie
Posts: 6
Joined: Wed Apr 11, 2007 3:05 pm

Post by contiw »

[^a-z\-\,\']|(\,.*\,)

I have difficulties with the "double space" though.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You could simply replace multiple spaces with a single space.
contiw
Forum Newbie
Posts: 6
Joined: Wed Apr 11, 2007 3:05 pm

Post by contiw »

Thanks Most Helpful Fade! :-)
I will replace the double space before regex validate.
contiW
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

unless more than two spaces is allowed, remember to replace 2+ spaces with a single one..
contiw
Forum Newbie
Posts: 6
Joined: Wed Apr 11, 2007 3:05 pm

Post by contiw »

Thanks nickvd.
contiW
Post Reply