Subject: | Regular expression syntax errors after adding simple regexps when unroll_plus is enabled |
Hi,
1 bugs is reported by a Debian user :
This perl script terminates with error like:
Unmatched ( in regex; marked by <-- HERE in m/\A( <-- HERE (x)\*(\??)\Z/ at
/usr/share/perl5/Regexp/Assemble.pm line 2734.
--->8---
use strict;
use Regexp::Assemble;
my $ra = Regexp::Assemble->new(unroll_plus => 1);
# any of bellow valid regular expression can be uncommented, to show problem
#$ra->add('((a|b)cz+)?');
#$ra->add('((ab|cy)z)');
$ra->add('((x)y)'); # simplest one
#$ra->add('((x)+y)+');
#$ra->add('(b(x))');
#$ra->add('a(b(x))');
print $ra->re;
---8<---
It looks that Regexp::Assembler incorrectly handles paranthesis for some
reasons in this simple expressions. Interesingly despite this "simplest
one" example not having "+" operator, Regexp::Assemble behaves correctly
after disabling unroll_plus option!