In the latter case, there are three issues I'm aware ofString interpolation of variables only happens for literal regexes in the source code. So if the pattern is read from a file or database this isn't an issue.
- code injection by string interpolation, like /@{ do_evil() }/
- code injection by regex, like /(?{ do_evil() })/
- exponential time regexes with excessive backtracking, something like /((x*)*)*/ IIRC </ol?
Embedded code within a pattern is only allowed within the scope of use re 'eval'; otherwise trying to compile such a regex from a string will die at run time.
The third one is a genuine issue, in terms of both CPU and memory usage.
Dave.
In reply to Re^2: Is it safe to use external strings for regexes?
by dave_the_m
in thread Is it safe to use external strings for regexes?
by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |