Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Search a match to a regex from the END of a string

by flexvault (Monsignor)
on Mar 15, 2013 at 14:17 UTC ( #1023706=note: print w/replies, xml ) Need Help??

in reply to Search a match to a regex from the END of a string


And there is 'rindex' which is very fast and easy to use.

perl -e '$d="/usr/local/bin/perl"; $i=rindex($d,"\/"); print substr +($d,$i+1),"\n";'
which prints 'perl'. The Camel book has examples of how to do recursive searches.

Good Luck...Ed

"Well done is better than well said." - Benjamin Franklin

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023706]
talexb admires the shimmering pool after an enjoyable hour-long All Hands meeting spent listening with one ear and reading Perlmonks with the other .. ear.
[talexb]: Used all my votes during that meeting .. been a while since I've done that. Now, back to work. Good localtime, monks!
[Corion]: talexb: You enjoyed the All Hands meeting in the pool?!
[Corion]: I understand "surfing" in the pool ;)
[talexb]: Corion I admired the pool .. I wasn't .. soaking in it. ;)

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (12)
As of 2017-07-20 15:07 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (304 votes). Check out past polls.