NYCPHP Meetup

NYPHP.org

[nycphp-talk] validating proper name capitalization

Chuck Reeves chuck.reeves at gmail.com
Fri Sep 23 09:57:59 EDT 2011


Just curious, how does Ronald McDonald supposed to fit in this convention?

 

Chuck Reeves

President

631.374.0772

MANCHUCK | www.manchuck.com

 

From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of David Mintz
Sent: Friday, September 23, 2011 9:55 AM
To: NYPHP Talk
Subject: [nycphp-talk] validating proper name capitalization

 


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/18a62394/attachment.html>


More information about the talk mailing list