Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Match last word in a sentence

by eyepopslikeamosquito (Archbishop)
on Aug 14, 2021 at 00:06 UTC ( [id://11135834]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    my $the_rest = $1;
    print "the_rest='$the_rest'\n";
    print "last='$last'\n";
    
  2. or download this
    the_rest='This is my lis'
    last='t'
    
  3. or download this
    $list =~ /
        ^(.+)    # The 'rest' (Everything before last word)
        \b(\w+)  # Last 'word' (string of contiguous word characters)
        \W*$     # Possible non-word characters at end of string
    /x;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-24 14:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found