I use Regexp::Assemble in my project, but I don't understand why this little sample doesn't work:
#!/usr/bin/perl
use strict;
use warnings;
use Regexp::Assemble;
my $re1 = "(run (?:pre|post)flight script for .+)";
my $re2 = "((?:Configu|Prepa)ring volume .+)";
my $ra = Regexp::Assemble->new;
$ra->add($re1);
$ra->add($re2);
my $global = $ra->re;
print "GLOBAL: $global\n";
1;
I got this error:
Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE ?:(run (?:pre|post)flight script for|((?:Configu|Prepa)ring volume) .+)/ at /usr/share/perl5/Regexp/Assemble.pm line 1003.
Edit: If I just print the resulting Regexp ($ra->as_string) I got this:
GLOBAL: (?:(run (?:pre|post)flight script for|((?:Configu|Prepa)ring volume) .+)
There is one ')' missing...