in reply to Re: Simple string parsing help with regex
in thread Simple string parsing help with regex
The various new look-ahead/behind assertions from 5.10 are very cool, but I'll admit I haven't used them enough to find them handy yet, so in a case like this, I still think, "I want to get rid of every slash that follows a character other than a less-than, so I'll capture that character and replace them both with it," leading to this:
s|([^<])/|$1|g;
However, I just benchmarked that compared to your look-behind method, and yours is 75% faster. Guess I need to start learning those newer assertions, and not just for when it's impossible to do something the old way!
Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.
|
|---|