There's more than one way to do things | |
PerlMonks |
Re^3: Regexp substitution using variablesby LanX (Saint) |
on Nov 26, 2020 at 10:53 UTC ( [id://11124257]=note: print w/replies, xml ) | Need Help?? |
> ... e.g. the ability to include parenthesized sub-expressions in the "from" part and $1 back-references in the "to" part. Honestly .... store the full real regexp in your config and eval it (or eval it into a sub to optimize execution time)
There is no way to "safely" abstract the capture-var away, it has to be compiled into the regex and this needs an eval or /ee with all connected security issues. > but bear in mind I do need the full power of regexp substitutions, I have the impression your JSON format is an attempt to make it language agnostic. But the "full power" means you will be stuck with Perl. And full power means that security becomes an illusion.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|