diff --git a/ChangeLog b/ChangeLog index 84d7e44..78bcc0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,13 @@ now correctly backtracked, so this unnecessary restriction has been removed. regex engine. The Perl regex folks are aware of this usage and have made a note about it. +9. When an assertion is repeated, PCRE2 used to limit the maximum repetition to +1, believing that repeating an assertion is pointless. However, if a positive +assertion contains capturing groups, repetition can be useful. In any case, an +assertion could always be wrapped in a repeated group. The only restriction +that is now imposed is that an unlimited maximum is changed to one more than +the minimum. + Version 10.34 21-November-2019 ------------------------------ diff --git a/doc/html/pcre2pattern.html b/doc/html/pcre2pattern.html index 42d8515..36178b3 100644 --- a/doc/html/pcre2pattern.html +++ b/doc/html/pcre2pattern.html @@ -1901,8 +1901,8 @@ are permitted for groups with the same number, for example: (?|(?<AA>aa)|(?<AA>bb)) The duplicate name constraint can be disabled by setting the PCRE2_DUPNAMES -option at compile time, or by the use of (?J) within the pattern, as described -in the section entitled +option at compile time, or by the use of (?J) within the pattern, as described +in the section entitled "Internal Option Setting" above.
@@ -1968,7 +1968,7 @@ items: an escape such as \d or \pL that matches a single character a character class a backreference - a parenthesized group (including most assertions) + a parenthesized group (including lookaround assertions) a subroutine call (recursive or otherwise) The general repetition quantifier specifies a minimum and maximum number of @@ -2359,7 +2359,7 @@ of zero. For versions of PCRE2 less than 10.25, backreferences of this type used to cause the group that they reference to be treated as an atomic group. -This restriction no longer applies, and backtracking into such groups can occur +This restriction no longer applies, and backtracking into such groups can occur as normal.
-For compatibility with Perl, most assertion groups may be repeated; though it
-makes no sense to assert the same thing several times, the side effect of
-capturing may occasionally be useful. However, an assertion that forms the
-condition for a conditional group may not be quantified. In practice, for
-other assertions, there only three cases:
-
-
-(1) If the quantifier is {0}, the assertion is never obeyed during matching.
-However, it may contain internal capture groups that are called from elsewhere
-via the
-subroutine mechanism.
-
-
-(2) If quantifier is {0,n} where n is greater than zero, it is treated as if it
-were {0,1}. At run time, the rest of the pattern match is tried with and
-without the assertion, the order depending on the greediness of the quantifier.
-
-
-(3) If the minimum repetition is greater than zero, the quantifier is ignored.
-The assertion is obeyed just once when encountered during matching.
+Most assertion groups may be repeated; though it makes no sense to assert the
+same thing several times, the side effect of capturing in positive assertions
+may occasionally be useful. However, an assertion that forms the condition for
+a conditional group may not be quantified. PCRE2 used to restrict the
+repetition of assertions, but from release 10.35 the only restriction is that
+an unlimited maximum repetition is changed to be one more than the minimum. For
+example, {3,} is treated as {3,4}.
-Last updated: 29 December 2019
+Last updated: 01 January 2020
-Copyright © 1997-2019 University of Cambridge.
+Copyright © 1997-2020 University of Cambridge.
Return to the PCRE2 index page.
diff --git a/doc/pcre2.txt b/doc/pcre2.txt
index 974fafa..127e6ab 100644
--- a/doc/pcre2.txt
+++ b/doc/pcre2.txt
@@ -7729,7 +7729,7 @@ REPETITION
an escape such as \d or \pL that matches a single character
a character class
a backreference
- a parenthesized group (including most assertions)
+ a parenthesized group (including lookaround assertions)
a subroutine call (recursive or otherwise)
The general repetition quantifier specifies a minimum and maximum num-
@@ -8162,24 +8162,14 @@ ASSERTIONS
passes to the previous backtracking point, thus discarding any captured
strings within the assertion.
- For compatibility with Perl, most assertion groups may be repeated;
- though it makes no sense to assert the same thing several times, the
- side effect of capturing may occasionally be useful. However, an asser-
- tion that forms the condition for a conditional group may not be quan-
- tified. In practice, for other assertions, there only three cases:
-
- (1) If the quantifier is {0}, the assertion is never obeyed during
- matching. However, it may contain internal capture groups that are
- called from elsewhere via the subroutine mechanism.
-
- (2) If quantifier is {0,n} where n is greater than zero, it is treated
- as if it were {0,1}. At run time, the rest of the pattern match is
- tried with and without the assertion, the order depending on the greed-
- iness of the quantifier.
-
- (3) If the minimum repetition is greater than zero, the quantifier is
- ignored. The assertion is obeyed just once when encountered during
- matching.
+ Most assertion groups may be repeated; though it makes no sense to as-
+ sert the same thing several times, the side effect of capturing in pos-
+ itive assertions may occasionally be useful. However, an assertion that
+ forms the condition for a conditional group may not be quantified.
+ PCRE2 used to restrict the repetition of assertions, but from release
+ 10.35 the only restriction is that an unlimited maximum repetition is
+ changed to be one more than the minimum. For example, {3,} is treated
+ as {3,4}.
Alphabetic assertion names
@@ -9490,8 +9480,8 @@ AUTHOR
REVISION
- Last updated: 29 December 2019
- Copyright (c) 1997-2019 University of Cambridge.
+ Last updated: 01 January 2020
+ Copyright (c) 1997-2020 University of Cambridge.
------------------------------------------------------------------------------
diff --git a/doc/pcre2pattern.3 b/doc/pcre2pattern.3
index 9015679..c613878 100644
--- a/doc/pcre2pattern.3
+++ b/doc/pcre2pattern.3
@@ -1,4 +1,4 @@
-.TH PCRE2PATTERN 3 "29 December 2019" "PCRE2 10.35"
+.TH PCRE2PATTERN 3 "01 January 2020" "PCRE2 10.35"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.SH "PCRE2 REGULAR EXPRESSION DETAILS"
@@ -1902,8 +1902,8 @@ are permitted for groups with the same number, for example:
(?|(?