Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Answer: How do I escape meta-characters in a user-defined string?

by btrott (Parson)
on Mar 25, 2000 at 01:05 UTC ( #6103=categorized answer: print w/replies, xml ) Need Help??

Q&A > regular expressions > How do I escape meta-characters in a user-defined string? - Answer contributed by btrott

if($string=~/\Q$key\E/){
Quotes the metacharacters.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2018-01-19 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (215 votes). Check out past polls.

    Notices?