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

RegExp, grabbing first name

by Anonymous Monk
on Feb 25, 2016 at 16:34 UTC ( [id://1156122]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    
    $mystring = ($mystring =~ /(\w{3,})$/) ? $1 : '';
    Print “DOE”;
    
  2. or download this
    
    $mystring = ($mystring =~ / (\w{1,2}\s)(\w+)$/) ? $2 : '';
    Print “JOE”;
    
  3. or download this
    $mystring = ($mystring =~ /(\w{1}\s\w+)|(\w{3,})$/) ? $1 : '';
    
    print "\n $mystring\n";
    
  4. or download this
    #!/usr/bin/perl
    
    ...
      print "\n\n $2\n\n";
      
    }
    

Log In?
Username:
Password:

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

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

    No recent polls found