=item *
-XXX L<message|perldiag/"message">
+L<Useless use of greediness modifier|perldiag/"Useless use of greediness modifier '%c' in regex; marked by <-- HERE in m/%s/">
+
+This fixes [Perl #42957].
=back
(W misc) You have a \E in a double-quotish string without a C<\U>,
C<\L> or C<\Q> preceding it.
+=item Useless use of greediness modifier '%c' in regex; marked by S<<-- HERE> in m/%s/
+
+(W regexp) You specified something like these:
+
+ qr/a{3}?/
+ qr/b{1,1}+/
+
+The C<"?"> and C<"+"> don't have any effect, as they modify whether to
+match more or fewer when there is a choice, and by specifying to match
+exactly a given numer, there is no room left for a choice.
+
=item Useless use of %s in void context
(W void) You did something without a side effect in a context that does
ret = reg_node(pRExC_state, OPFAIL);
return ret;
}
+ else if (min == max
+ && RExC_parse < RExC_end
+ && (*RExC_parse == '?' || *RExC_parse == '+'))
+ {
+ if (SIZE_ONLY) {
+ ckWARN2reg(RExC_parse + 1,
+ "Useless use of greediness modifier '%c'",
+ *RExC_parse);
+ }
+ /* Absorb the modifier, so later code doesn't see nor use
+ * it */
+ nextchar(pRExC_state);
+ }
do_curly:
if ((flags&SIMPLE)) {
'Useless (?g) - use /g modifier {#} m/(?og{#}c)/',
'Useless (?c) - use /gc modifier {#} m/(?ogc{#})/',
],
+ '/a{1,1}?/' => 'Useless use of greediness modifier \'?\' {#} m/a{1,1}?{#}/',
+ '/b{3} +/x' => 'Useless use of greediness modifier \'+\' {#} m/b{3} +{#}/',
);
my @warnings_utf8 = mark_as_utf8(