Subject: | Should the plus be escaped? |
Try this program:
#!/usr/bin/env perl
use Regexp::Assemble::Compressed;
my $r = Regexp::Assemble::Compressed->new();
$r->add('\r\n');
$r->add('\s+\n');
$r->add('\n+');
$r->add('\n\s+|\s+\n');
print $r->re();
The output is:
(?^:(?:\n(?:\s+|\s+\n|\+)|(?:\s+|\r)\n))
I don't understand why the + in the string has been escaped.