Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^2: using variables in regular expr replace

by Fletch (Chancellor)
on Dec 02, 2004 at 17:57 UTC ( #411886=note: print w/ replies, xml ) Need Help??

in reply to Re: using variables in regular expr replace
in thread using variables in regular expr replace

And just to elaborate on why you need to do this, remember that [] indicates a character class inside a regular expression (i.e. [a-c] means any of the characters a, b, or c). Your [img ... 8-4 ... ] is being interpreted as a character class, and you've got an invalid range (the character 8 is "bigger" than 4 and hence the correct way to specify the range of characters would be [4-8]).

At any rate you really should either escape the square brackets or use \Q...\E as shown above (and you should read perldoc perlretut and perldoc perlre).

Comment on Re^2: using variables in regular expr replace
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2015-11-25 05:55 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (671 votes), past polls