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

Re: Reverse Regexing

by MrNobo1024 (Hermit)
on Aug 09, 2002 at 16:25 UTC ( #188961=note: print w/ replies, xml ) Need Help??


in reply to Reverse Regexing

sauoq's solution is good if you know it will be at the end of the string. If you just want it to search from right to left, s/^(.*)ed/$1/i will work.

--MrNobo1024
s]]HrLfbfe|EbBibmv]e|s}w}ciZx^RYhL}e^print


Comment on Re: Reverse Regexing
Re: Re: Reverse Regexing
by smalhotra (Scribe) on Aug 09, 2002 at 16:50 UTC
    Just thought I'd explain the previous regexes a little. The ^ represents the start of the string with $ represents the end of the string. The .* (greedy) part will match as many characters it can before 'ed'. On the other hand a .*? is non-greedy and will match as few as possible characters, in this case zero, before 'ed'. Also be sure to look at perldoc perlre. Hope this helps a little more.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2014-04-23 22:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (556 votes), past polls