Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^5: Newbie parsing problem

by mk. (Friar)
on Jan 26, 2007 at 12:21 UTC ( #596700=note: print w/replies, xml ) Need Help??


in reply to Re^4: Newbie parsing problem
in thread Newbie parsing problem

\w only matches letters, digits and underscores. since the hyphen is a non-word (\W), that regex interprets it as a separator, so that the second part of the last name is considered the first name.
the following code supports hyphenated first and last names:
my ($last, $first, $middle) = ($name =~ /([\w-]+)\W*?([\w-]+)\W*(\w)?/);

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*women.pm

Replies are listed 'Best First'.
Re^6: Newbie parsing problem
by rtremaine (Acolyte) on Jan 26, 2007 at 15:12 UTC
    ahhh, I see! thanks again for all your help!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://596700]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2022-01-25 15:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (67 votes). Check out past polls.

    Notices?