Using the eval works great for matches : $pattern = eval "qr$pattern" or die $@;
No, it doesn't.
First of all, it doesn't work at all if $pattern actually contains a pattern.
And then there are issues with improper escaping. If you pass /a\+/, it won't match "a" followed by "+" as desired.
In reply to Re^3: qr// and user provided regex patterns...
by ikegami
in thread qr// and user provided regex patterns...
by misterMatt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |