Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Maybe Escape in Dynamic RegExps

by halley (Prior)
on May 02, 2004 at 14:10 UTC ( #349816=note: print w/ replies, xml ) Need Help??


in reply to Maybe Escape in Dynamic RegExps

The \Q and \E is the correct answer; the quotemeta() function is the equivalent function.

However, for perl5 anyway, a useful rule of thumb is that alphanumeric characters need escapes to be special, and everything else need escapes to be normal. There are a lot of non-alphanumeric characters that the escaping would be redundant but not harmful (such as \=).

--
[ e d @ h a l l e y . c c ]


Comment on Re: Maybe Escape in Dynamic RegExps
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2014-09-17 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (92 votes), past polls