Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: RegExp, grabbing first name

by Maresia (Beadle)
on Feb 25, 2016 at 16:53 UTC ( [id://1156125]=note: print w/replies, xml ) Need Help??


in reply to RegExp, grabbing first name

Hi,this line right right should work, quick test, but it worked on both options for me:
$mystring = ($mystring =~ /(\w{3,})$/) ? $1 : '';

Replies are listed 'Best First'.
Re^2: RegExp, grabbing first name
by ww (Archbishop) on Feb 26, 2016 at 12:41 UTC

    Re Re^3: RegExp, grabbing first name Listing Lname, MInitial, Fname is not a convention of which I'm aware.

    OP seems satisfied (below) with some of the suggestions, but IMHO, "A" is an abbreviation of the Fname for "SMITH" (as posted by OP).


    Come, let us reason together: Spirit of the Monastery
Re^2: RegExp, grabbing first name
by Anonymous Monk on Feb 25, 2016 at 18:53 UTC
    Thanks, but it didn't work as I expected:
    I have to get the first name only no matter what the choices are:
    my $string_1 = "SMITH, A DOE"; my $mystring_2 = "BULLOCK JOE A";
    I am looking to get:

    String 1 = DOE
    String 2 = JOE

    My post was not clear, sorry!
    Thank you!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-18 04:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found