[nycphp-talk] validating proper name capitalization
David Mintz
david at davidmintz.org
Fri Sep 23 11:02:01 EDT 2011
On Fri, Sep 23, 2011 at 10:41 AM, justin <justin at justinhileman.info> wrote:
> You might be better off enumerating "goodness"...
>
> /^
> ([A-Z][a-z]+)+ # first name, consisting of any
> number of AbAbc, handles "LaDawn"
> \s+
> ( # middle name (optional)
> [A-Z] # at the very least, has a capital
> letter
> (
> \. # ends with either a dot
> | # ... or ...
> [a-z]+([A-Z][a-z]+)? # the rest of a name
> )? # but again, that's totally optional
> \s+
> )?
> ([A-Z][a-z]+)+ # and a last name, following the
> same convention as the first (McGraw)
> $/x
>
>
> -- justin
>
>
>
Interesting, thanks.
As it happens, the last, middle and first names are separate fields.
(Actually I am labelling them "surname(s)" and "given name(s)" just to keep
it confusing.)
btw McDonald and its brethren pass the test I've written. But so does
McdoNald, which is why I am thinking, ok, you are only so clever and if they
want to input data that is wrong in some way or other, at some point you
can't stop 'em. You did your due diligence.
--
David Mintz
http://davidmintz.org/
It ain't over:
http://www.healthcare-now.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20110923/0edb14a5/attachment.html>
More information about the talk
mailing list