in reply to Re: Re: replacing variable in regex - probs with special chars?
in thread replacing variable in regex - probs with special chars?

Yes, you want:

s/\Q$complete\E/...
because $complete has metacharacters in it. Pretty much any time you want to stick a variable in a regex, you want to use \Q...\E. The only exception is if the variable is supposed to contain a regex itself, but that can get dangerous (arbitrary perl code in regexes, etc).

Also, maybe Template::Toolkit would be of use. It just does general text templates, making no assumptions about web apps or HTML.

  • Comment on Re: Re: Re: replacing variable in regex - probs with special chars?
  • Download Code