[nycphp-talk] validating proper name capitalization
David Mintz
david at davidmintz.org
Fri Sep 23 09:54:43 EDT 2011
I'm trying to require users to input proper names with capitalization that
conforms to convention. So, you can't go e. e. cummings on me, and you can't
be JOHN SOMEBODY either. And you can't have your caps lock on and enter jOHN
sOMEBODY. That much is pretty easy, but I am finding the more subtle cases
pretty hard.
So far, I have
/\b[a-z][A-Z]+|\b[A-Z]{2,}+|^[a-z ]+$/
to test against (false is good). This works on all the cases I have tested
except "cuMmings," which gets by. But I am thinking, maybe enough is enough;
you can't control everything.
Just wondering if anyone has tackled this before or has any thoughts.
btw this is on top of other whitelist-style validation.
--
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/bbcb0984/attachment.html>
More information about the talk
mailing list