PHP Name Validation
Posted on 2007-11-25
I need help creating a regex to validate either a first name or a last name (separate fields on my form). Specifically:
1) The name must contain only letters, one space, a single apostrophe, or a single hyphen, or a single period;
2) If the name contains either an apostrophe, a hyphen, or a space, the apostrophe, hyphen, or space must be preceded and followed by at least one letter.
3) If the name contains a period, it must be preceded by a letter and followed by a space and letter.