Re: Q on RegExp & extended Char

From: Date: Mon, 15 Dec 2003 21:51:57 +0000
Subject: Re: Q on RegExp & extended Char
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-172759@lists.php.net to get a copy of this message
I should have posted some "rules" with this... assuming: - a SPACE is used to delimit first from last name [Walter Torres] - a HYPHEN is used to separate a dual name (British style) [Conrad-Smyth] - an APOSTROPHE is used in many Irish and Scotish names [O'Reilly] - a PERIOD is used in titles, suffixes [Dr. Sr. Jr.] - a PERIOD is used for Initials [Walter G. Torres] then... - allow apostrophes, but only if preceded *and* followed by a Alpha/Extend - allow hyphen/dash, but only if preceded *and* followed by a Alpha/Extend - allow PERIOD, but only if preceded by a Alpha/Extend *and* followed by a SPACE or EOS - allow SPACE, but only if preceded *and* followed by a Alpha/Extend also... - allow x80 thru xFF I've come up with this... /^([a-z\x80-\xFF]+(. )?[ ]?)+$/i |_____________||___||__| ^ ^ ^ ^ | | | | |-------- whole block ONE or more times | | | | | |---- SPACE - ZERO or ONE times alpha & extended | ONE or more |-------- PERIOD - ZERO or ONE times but I can't seem to figure out how to get the HYPEN & apostrophe rules in here. But this does allow multiple spaces - which It really shouldn't but... It also lets me add SPACEs at the end, oh well... Any ideas? Thanks Walter

« previous php.general (#172759) next »