It's relatively easy to spot that it's just a (?:..........)
It could just as easily be two `(?:...)` back to back. Therefore, tidying this up requires a complete regexp parser. And since Perl regex patterns can contain arbitrary Perl code, you also need a complete Perl parser if the pattern includes `(?{...})` or `(??{...})`.
So no, it's immensely hard to spot that it's just `(?:...)`.
It might be easier to address the problem at the source, which means replacing
withmy $augmented_pattern = "$re"; ... my $re = qr/$augmented_pattern/;
my ($pattern, $mods) = re::regexp_pattern($re); ... my $re = eval("qr/\$pattern/$mods") or die $@;
In reply to Re: Tidying and simplifying a regular expression
by ikegami
in thread Tidying and simplifying a regular expression
by Dallaylaen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |