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!