Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Regular Expression Help

by Anonymous Monk
on Nov 18, 2005 at 20:09 UTC ( [id://509932]=note: print w/replies, xml ) Need Help??


in reply to Re: Regular Expression Help
in thread Regular Expression Help

It doesn't work.

Replies are listed 'Best First'.
Re^3: Regular Expression Help
by ptum (Priest) on Nov 18, 2005 at 20:17 UTC
    Fletch is right -- use File::Basename -- but in the more general case of finding the last token in a string, that regex ought to work:
    #!/usr/local/bin/perl use strict; my $string = '/one/two and three/and four / and five'; if ($string =~ /.*\/(.*?)$/) { print "Last token: $1\n"; }
    Or you could always split on your token separator and grab the last element in the resulting array.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://509932]
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-26 05:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found