(F syntax, regexp) The regular expression pattern had too many occurrences
of the specified modifier. Remove the extraneous ones.
+=item Regexp modifier "%c" may not appear after the "-"
+
+(F regexp) Turning off the given modifier has the side effect of turning
+on another one. Perl currently doesn't allow this. Reword the regular
+expression to use the modifier you want to turn on (and place it before
+the minus), instead of the one you want to turn off.
+
=item Regexp modifiers "/%c" and "/%c" are mutually exclusive
(F syntax, regexp) The regular expression pattern had more than one of these
<-- HERE shows in the regular expression about where the problem was
discovered. This happens when using the C<(?^...)> construct to tell
Perl to use the default regular expression modifiers, and you
-redundantly specify a default modifier; or having a modifier that can't
-be turned off (such as C<"p"> or C<"l">) after a minus. For other
+redundantly specify a default modifier. For other
causes, see L<perlre>.
=item Sequence \%s... not terminated in regex; marked by <-- HERE in m/%s/
goto excess_modifier;
}
else if (flagsp == &negflags) {
- goto fail_modifiers;
+ goto neg_modifier;
}
cs = REGEX_LOCALE_CHARSET;
has_charset_modifier = LOCALE_PAT_MOD;
goto excess_modifier;
}
else if (flagsp == &negflags) {
- goto fail_modifiers;
+ goto neg_modifier;
}
cs = REGEX_UNICODE_CHARSET;
has_charset_modifier = UNICODE_PAT_MOD;
break;
case ASCII_RESTRICT_PAT_MOD:
if (flagsp == &negflags) {
- goto fail_modifiers;
+ goto neg_modifier;
}
if (has_charset_modifier) {
if (cs != REGEX_ASCII_RESTRICTED_CHARSET) {
has_charset_modifier = ASCII_RESTRICT_PAT_MOD;
break;
case DEPENDS_PAT_MOD:
- if (has_use_defaults
- || flagsp == &negflags)
- {
+ if (has_use_defaults) {
goto fail_modifiers;
}
+ else if (flagsp == &negflags) {
+ goto neg_modifier;
+ }
else if (has_charset_modifier) {
goto excess_modifier;
}
vFAIL3("Regexp modifiers \"%c\" and \"%c\" are mutually exclusive", has_charset_modifier, *(RExC_parse - 1));
}
/*NOTREACHED*/
+ neg_modifier:
+ RExC_parse++;
+ vFAIL2("Regexp modifier \"%c\" may not appear after the \"-\"", *(RExC_parse - 1));
+ /*NOTREACHED*/
case ONCE_PAT_MOD: /* 'o' */
case GLOBAL_PAT_MOD: /* 'g' */
if (SIZE_ONLY && ckWARN(WARN_REGEXP)) {
'/(?da:foo)/' => 'Regexp modifiers "d" and "a" are mutually exclusive in regex; marked by {#} in m/(?da{#}:foo)/',
'/(?lil:foo)/' => 'Regexp modifier "l" may not appear twice in regex; marked by {#} in m/(?lil{#}:foo)/',
'/(?aaia:foo)/' => 'Regexp modifier "a" may appear a maximum of twice in regex; marked by {#} in m/(?aaia{#}:foo)/',
+'/(?i-l:foo)/' => 'Regexp modifier "l" may not appear after the "-" in regex; marked by {#} in m/(?i-l{#}:foo)/',
'/((x)/' => 'Unmatched ( in regex; marked by {#} in m/({#}(x)/',