I have got sick and tired of the same problem every time I make an application that submits user information. That problem is "What makes up a valid first name?" "What is the maximum length?" "What characters should be allowed and where?" These are the same old questions that I'm sure most of you have given up on and and just thought "I'll just guess what will best fit everyone".
I have created a form that I need everyone's help with. I would like you to type your first name (your legal one) into the field and click submit and see if it works. If it does great you are covered. Now if it does not match you must have a unique name and I want to know about it, that way I can adjust my regular expression so it will match your name.
This will help everyone in the programming community buy giving them a real world tested first name validation so that they can lock their forms down to only accept what is to be expected.
I invite anyone to use the regular expression in the field below. It is free for the taking and as I receive names that did not work I will adjust it, so check back periodically. Eventually I will have enough data say over 5 years that I can confidently say that this will match all names out there and people can start to use it as a standard.
Update: I know there are French people out there that love to spell
their names exactly as they write it but unless I set my PHP LOCALE to be French
letters with accents like é are not considered a match for a-z. please note that
if you take my expression I have provided and change you LOCALE when compiling
that this will work for your French names. It is all based on your PCRE's
character tables and mine is set to English.
Regular expression I am using:
Explanation of regular expression: