Because I recently learned about regexp_pattern (see thread), this might work, but it might not handle every case (there are other flags besides "u"):
use re (); for (1..10) { my ($pat, $flags) = re::regexp_pattern($rex); $rex = ($flags eq "u" or $flags eq "") ? qr{$pat.} : qr{$rex.}; }
In reply to Re: Tidying and simplifying a regular expression
by tinita
in thread Tidying and simplifying a regular expression
by Dallaylaen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |