Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Using string literal in regexp

by davorg (Chancellor)
on Jun 16, 2006 at 15:55 UTC ( [id://555825]=note: print w/replies, xml ) Need Help??


in reply to Using string literal in regexp

quotemeta or \Q ... \E.

my $bigfoo=quotemeta('aabbaaa$@!#@#$^$#@^bbabaaba'); assert $bigfoo =~ /(a|b)*$foo(a|b)*/;

or

my $bigfoo='aabbaaa$@!#@#$^$#@^bbabaaba'; assert $bigfoo =~ /(a|b)*\Q$foo\E(a|b)*/;
--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2024-04-16 18:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found