sanku has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Any one knows that in perl is there any module can be used for checking the first name and last name in any language other then special char. I mean in the name string it should allow only name like spanish, english, danish, etc., Thanks in advance
  • Comment on Regular expression or module to use only language character

Replies are listed 'Best First'.
Re: Regular expression or module to use only language character
by ww (Archbishop) on Oct 20, 2010 at 21:07 UTC
    Are you asking to validate any pair of words that might be used as first and last names (so long as they don't contain special characters)?

    If so, what shall we do about first names taken from the language in question, but not commonly considered "names?" "Charity" might be an english language edge case; what if I named my nextborn "Broccoli?"

    And what do we do with the commonly accepted names in Spanish that do have accents -- I believe Jesús and María are common cases.

    I offer this hypothesis despite the seemingly contrary second sentence, which might be understood to mean that you want only to deal with names of languages. But you might wish to clarify your question.

Re: Regular expression or module to use only language character
by Anonymous Monk on Oct 20, 2010 at 14:15 UTC
Re: Regular expression or module to use only language character
by aquarium (Curate) on Oct 20, 2010 at 23:17 UTC
    so you want the first and last name to only contain allowable unicode characters, or only a subset of these characters in use in certain languages? if the latter, this would be most difficult, as there are many (unicode) characters that cross boundaries. if you're trying to do it the old fashioned way with the legacy ansi encoded extensions, it would still be quite hard. even harder if you wanted to make sure that first name character set (language) used matches the surname. especially that some people adjust their first names to match local language, say having emigrated. in the end you'll avoid difficulty just by boiling it down to something simple, like checking that both first and last name contain UTF-8 characters or such.
    the hardest line to type correctly is: stty erase ^H