Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Read in a regex without having to use string eval?

by ikegami (Pope)
on Nov 23, 2011 at 01:32 UTC ( #939575=note: print w/replies, xml ) Need Help??


in reply to Re^2: Read in a regex without having to use string eval?
in thread Read in a regex without having to use string eval?

I was actually referring to the qr{} part, but yeah, it's basically the same for \Q.

The deal with the quotemeta escape and such as well as interpolation is that they are meaningful in literals (such as qq"" and qr//), but they are not perceived as such by the regex engine should they be provided to it.

You can print out the result of qr to see the pattern that got compiled.

  • Comment on Re^3: Read in a regex without having to use string eval?

Replies are listed 'Best First'.
Re^4: Read in a regex without having to use string eval?
by Argel (Prior) on Nov 23, 2011 at 02:17 UTC
    I figured you meant the qr{}, but that along with the fact you did not use the quotemeta tags in any example was enough to jolt my brain into remembering that quotemeta was also Perl code. It's amazing how simple mistakes can be so hard to catch at times!! Again, thanks for the help!!

    Elda Taluta; Sarks Sark; Ark Arks
    My deviantART gallery

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://939575]
help
Chatterbox?
[erix]: that's bad... I can only wish you good luck
[Discipulus]: not even in Canada is easy to find a decent job
Discipulus was a question
[GotToBTru]: current job found me
Discipulus is so lucky to have a decent job, with old, favorable contract, done before the ultralibersm arrived in Eataly
[Lady_Aleena]: Has anyone here ever use pcregrep? I can't seem to get the --include regex right. --include=*.p[lm] works in grep but not pcregrep.
[erix]: to lift your spirits, here is some more happy Randy news...
[Lady_Aleena]: The reason I would like to use pcregrep is because it can do multiline searches supposedly.
[perldigious]: What are your criteria for looking Tanktalus? What things must a job have for you to consider it? And where are you in your career? Start, middle, or end?

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-05-23 19:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?