use strict;
use warnings;
-our $VERSION = "0.17";
+our $VERSION = "0.18";
our @ISA = qw(Exporter);
our @EXPORT_OK = ('regmust',
qw(is_regexp regexp_pattern
l => 1,
u => 2,
a => 3,
+ aa => 4,
);
sub setcolor {
} elsif ($s =~ s/^\///) {
my $reflags = $^H{reflags} || 0;
my $seen_charset;
- for(split//, $s) {
+ while ($s =~ m/( aa | . )/gx) {
+ $_ = $1;
if (/[adul]/) {
if ($on) {
if ($seen_charset) {
.qq 'are exclusive'
);
}
+ elsif ($seen_charset eq 'a') {
+ Carp::carp(
+ qq 'The "a" flag may only appear twice if '
+ .qq 'adjacent, like "aa"'
+ );
+ }
else {
Carp::carp(
qq 'The "$seen_charset" flag may not appear '
use strict;
-use Test::More tests => 48;
+use Test::More tests => 58;
-my @flags = qw( a d l u );
+my @flags = qw( a d l u aa );
use re '/i';
ok "Foo" =~ /foo/, 'use re "/i"';
$w = "";
eval "use re '/$i$j'";
if ($i eq $j) {
- like $w, qr/The \"$i\" flag may not appear twice/,
- "warning with use re \"/$i$i\"";
+ if ($i eq 'a') {
+ is ($w, "", "no warning with use re \"/aa\", $w");
+ }
+ else {
+ like $w, qr/The \"$i\" flag may not appear twice/,
+ "warning with use re \"/$i$i\"";
+ }
}
else {
- like $w, qr/The "$i" and "$j" flags are exclusive/,
- "warning with eval \"use re \"/$i$j\"";
+ if ($j =~ /$i/) {
+ # If one is a subset of the other, re.pm uses the longest one.
+ like $w, qr/The "$j" and "$i" flags are exclusive/,
+ "warning with eval \"use re \"/$j$i\"";
+ }
+ else {
+ like $w, qr/The "$i" and "$j" flags are exclusive/,
+ "warning with eval \"use re \"/$i$j\"";
+ }
}
}
}
+
+ $w = "";
+ eval "use re '/axa'";
+ like $w, qr/The "a" flag may only appear twice if adjacent, like "aa"/,
+ "warning with eval \"use re \"/axa\"";
+
+
}