summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2015-08-27 21:07:43 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2015-08-27 21:08:00 +0100
commitaeb325e6e832467c38c4baff1ee68c7726ad9f7c (patch)
tree69f92e1cdd7ce7e4bff6d5685051e176fe8afb0a
parenta424c7b38e1d235ca8e5dc410ed51b7b4f9045e9 (diff)
downloadperl-aeb325e6e832467c38c4baff1ee68c7726ad9f7c.tar.gz
PATCH: [perl 125825] {n}+ possessive quantifier broken
I was unaware of this construct when I wrote the commit that broke it, and there were no tests for it. Now there are. (cherry picked from commit 9a7bb2f73a8a1b561890191974201d576371e7f9)
-rw-r--r--pod/perldelta.pod7
-rw-r--r--regcomp.c4
-rw-r--r--t/re/re_tests2
-rw-r--r--t/re/reg_mesg.t1
4 files changed, 10 insertions, 4 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 14da137516..4c8a7aaab5 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -232,6 +232,13 @@ to mean C<setpgrp(0)>. This has been fixed.
A crash with C<< %::=(); J->${\"::"} >> has been fixed.
L<[perl #125541]|https://rt.perl.org/Ticket/Display.html?id=125541>
+=item *
+
+Regular expression possesive quantifier v5.20 regression now fixed.
+C<qr/>I<PAT>C<{>I<min>,I<max>C<}+>C</> is supposed to behave identically
+to C<qr/(?E<gt>>I<PAT>C<{>I<min>,I<max>C<})/>. Since v5.20, this didn't
+work if I<min> and I<max> were equal. [perl #125825]
+
=back
=head1 Acknowledgements
diff --git a/regcomp.c b/regcomp.c
index 84af011340..606b3373b3 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -10455,9 +10455,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
ret = reg_node(pRExC_state, OPFAIL);
return ret;
}
- else if (min == max
- && RExC_parse < RExC_end
- && (*RExC_parse == '?' || *RExC_parse == '+'))
+ else if (min == max && RExC_parse < RExC_end && *RExC_parse == '?')
{
if (SIZE_ONLY) {
ckWARN2reg(RExC_parse + 1,
diff --git a/t/re/re_tests b/t/re/re_tests
index d883add8f0..11c4125070 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -1887,5 +1887,7 @@ A+(*PRUNE)BC(?{}) AAABC y $& AAABC
/(alias|status)es$/i Statuses y $1 Status # [perl #121778]
(.)(?{$~=$^N}) \x{100} y $~ \x{100} # [perl #123135]
+/(a+){1}+a/ aaa n - - # [perl #125825]
+
# Keep these lines at the end of the file
# vim: softtabstop=0 noexpandtab
diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t
index 55eda189da..77f7aa10d4 100644
--- a/t/re/reg_mesg.t
+++ b/t/re/reg_mesg.t
@@ -382,7 +382,6 @@ my @warning = (
'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(