http://www.perlmonks.org?node_id=939572


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

I knew I was missing something obvious! I'm so used to using quotemeta in RegEx's that I was thinking it was RegEx code, not Perl code! Thanks! Needed someone to point that out to me!! I'm aware about the rest.

Elda Taluta; Sarks Sark; Ark Arks
My deviantART gallery

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

Replies are listed 'Best First'.
Re^3: Read in a regex without having to use string eval?
by ikegami (Patriarch) on Nov 23, 2011 at 01:32 UTC

    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.

      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