Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Unrecognized escape \Q passed through in regex

by ikegami (Patriarch)
on Jan 26, 2006 at 18:33 UTC ( [id://525803]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # Text.
    $text = 'Renata';
    $window =~ /\b\Q$text\E\b/ism
    
  2. or download this
    # Uncompiled regexp.
    $text = 'Renata';
    $regexp = '\\b' . quotemeta($text) . '\\b';
    $window =~ /$regexp/ism
    
  3. or download this
    # Compiled regexp.
    $regexp = qr/\b\QRenata\E\b/ism;
    $window =~ $regexp
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found