in reply to simple regex for names or last names

"d. jones" won't match because of the space, which isn't allowed by your regex--you are properly allowing periods and dashes.

As for accepting a "middle. last" value in the last name field, it would probably be better to just have an optional middle initial field.

Also, keep in mind other characters for last names, such as "O'Hare" and "la Fontaine". (why is '@' an allowed character? Also note you're allowing '_' by using \w)
Update: As noted by tlm, \w is allowing 0-9 as well (i originally misread OP's "alphabetical" as "alphanumerical" so only mentioned the '_')
  • Comment on Re: simple regex for names or last names

Replies are listed 'Best First'.
Re^2: simple regex for names or last names
by tlm (Prior) on May 03, 2005 at 11:50 UTC

    Also note you're allowing '_' by using \w

    ...and decimal digits too.

    the lowliest monk