Documentation update.
This commit is contained in:
parent
937617f343
commit
b053ad9343
|
@ -2287,24 +2287,35 @@ those that look ahead of the current position in the subject string, and those
|
||||||
that look behind it, and in each case an assertion may be positive (must
|
that look behind it, and in each case an assertion may be positive (must
|
||||||
succeed for matching to continue) or negative (must not succeed for matching to
|
succeed for matching to continue) or negative (must not succeed for matching to
|
||||||
continue). An assertion subpattern is matched in the normal way, except that,
|
continue). An assertion subpattern is matched in the normal way, except that,
|
||||||
when matching continues afterwards, the matching position in the subject string
|
when matching continues after a successful assertion, the matching position in
|
||||||
is as it was at the start of the assertion.
|
the subject string is as it was before the assertion was processed.
|
||||||
</P>
|
</P>
|
||||||
<P>
|
<P>
|
||||||
Assertion subpatterns are not capturing subpatterns. If an assertion contains
|
Assertion subpatterns are not capturing subpatterns. If an assertion contains
|
||||||
capturing subpatterns within it, these are counted for the purposes of
|
capturing subpatterns within it, these are counted for the purposes of
|
||||||
numbering the capturing subpatterns in the whole pattern. However, substring
|
numbering the capturing subpatterns in the whole pattern. Within each branch of
|
||||||
capturing is carried out only for positive assertions that succeed, that is,
|
an assertion, locally captured substrings may be referenced in the usual way.
|
||||||
one of their branches matches, so matching continues after the assertion. If
|
For example, a sequence such as (.)\g{-1} can be used to check that two
|
||||||
all branches of a positive assertion fail to match, nothing is captured, and
|
adjacent characters are the same.
|
||||||
control is passed to the previous backtracking point.
|
|
||||||
</P>
|
</P>
|
||||||
<P>
|
<P>
|
||||||
No capturing is done for a negative assertion unless it is being used as a
|
When a branch within an assertion fails to match, any substrings that were
|
||||||
condition in a
|
captured are discarded (as happens with any pattern branch that fails to
|
||||||
<a href="#subpatternsassubroutines">conditional subpattern</a>
|
match). A negative assertion succeeds only when all its branches fail to match;
|
||||||
(see the discussion below). Matching continues after a non-conditional negative
|
this means that no captured substrings are ever retained after a successful
|
||||||
assertion only if all its branches fail to match.
|
negative assertion. When an assertion contains a matching branch, what happens
|
||||||
|
depends on the type of assertion.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
For a positive assertion, internally captured substrings in the successful
|
||||||
|
branch are retained, and matching continues with the next pattern item after
|
||||||
|
the assertion. For a negative assertion, a matching branch means that the
|
||||||
|
assertion has failed. If the assertion is being used as a condition in a
|
||||||
|
<a href="#conditions">conditional subpattern</a>
|
||||||
|
(see below), captured substrings are retained, because matching continues with
|
||||||
|
the "no" branch of the condition. For other failing negative assertions,
|
||||||
|
control passes to the previous backtracking point, thus discarding any captured
|
||||||
|
strings within the assertion.
|
||||||
</P>
|
</P>
|
||||||
<P>
|
<P>
|
||||||
For compatibility with Perl, most assertion subpatterns may be repeated; though
|
For compatibility with Perl, most assertion subpatterns may be repeated; though
|
||||||
|
@ -2502,7 +2513,8 @@ already been matched. The two possible forms of conditional subpattern are:
|
||||||
(?(condition)yes-pattern|no-pattern)
|
(?(condition)yes-pattern|no-pattern)
|
||||||
</pre>
|
</pre>
|
||||||
If the condition is satisfied, the yes-pattern is used; otherwise the
|
If the condition is satisfied, the yes-pattern is used; otherwise the
|
||||||
no-pattern (if present) is used. If there are more than two alternatives in the
|
no-pattern (if present) is used. An absent no-pattern is equivalent to an empty
|
||||||
|
string (it always matches). If there are more than two alternatives in the
|
||||||
subpattern, a compile-time error occurs. Each of the two alternatives may
|
subpattern, a compile-time error occurs. Each of the two alternatives may
|
||||||
itself contain nested subpatterns of any form, including conditional
|
itself contain nested subpatterns of any form, including conditional
|
||||||
subpatterns; the restriction to two alternatives applies only at the level of
|
subpatterns; the restriction to two alternatives applies only at the level of
|
||||||
|
@ -3497,7 +3509,7 @@ Cambridge, England.
|
||||||
</P>
|
</P>
|
||||||
<br><a name="SEC30" href="#TOC1">REVISION</a><br>
|
<br><a name="SEC30" href="#TOC1">REVISION</a><br>
|
||||||
<P>
|
<P>
|
||||||
Last updated: 07 July 2018
|
Last updated: 10 July 2018
|
||||||
<br>
|
<br>
|
||||||
Copyright © 1997-2018 University of Cambridge.
|
Copyright © 1997-2018 University of Cambridge.
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -7806,23 +7806,33 @@ ASSERTIONS
|
||||||
string, and those that look behind it, and in each case an assertion
|
string, and those that look behind it, and in each case an assertion
|
||||||
may be positive (must succeed for matching to continue) or negative
|
may be positive (must succeed for matching to continue) or negative
|
||||||
(must not succeed for matching to continue). An assertion subpattern is
|
(must not succeed for matching to continue). An assertion subpattern is
|
||||||
matched in the normal way, except that, when matching continues after-
|
matched in the normal way, except that, when matching continues after a
|
||||||
wards, the matching position in the subject string is as it was at the
|
successful assertion, the matching position in the subject string is as
|
||||||
start of the assertion.
|
it was before the assertion was processed.
|
||||||
|
|
||||||
Assertion subpatterns are not capturing subpatterns. If an assertion
|
Assertion subpatterns are not capturing subpatterns. If an assertion
|
||||||
contains capturing subpatterns within it, these are counted for the
|
contains capturing subpatterns within it, these are counted for the
|
||||||
purposes of numbering the capturing subpatterns in the whole pattern.
|
purposes of numbering the capturing subpatterns in the whole pattern.
|
||||||
However, substring capturing is carried out only for positive asser-
|
Within each branch of an assertion, locally captured substrings may be
|
||||||
tions that succeed, that is, one of their branches matches, so matching
|
referenced in the usual way. For example, a sequence such as (.)\g{-1}
|
||||||
continues after the assertion. If all branches of a positive assertion
|
can be used to check that two adjacent characters are the same.
|
||||||
fail to match, nothing is captured, and control is passed to the previ-
|
|
||||||
ous backtracking point.
|
|
||||||
|
|
||||||
No capturing is done for a negative assertion unless it is being used
|
When a branch within an assertion fails to match, any substrings that
|
||||||
as a condition in a conditional subpattern (see the discussion below).
|
were captured are discarded (as happens with any pattern branch that
|
||||||
Matching continues after a non-conditional negative assertion only if
|
fails to match). A negative assertion succeeds only when all its
|
||||||
all its branches fail to match.
|
branches fail to match; this means that no captured substrings are ever
|
||||||
|
retained after a successful negative assertion. When an assertion con-
|
||||||
|
tains a matching branch, what happens depends on the type of assertion.
|
||||||
|
|
||||||
|
For a positive assertion, internally captured substrings in the suc-
|
||||||
|
cessful branch are retained, and matching continues with the next pat-
|
||||||
|
tern item after the assertion. For a negative assertion, a matching
|
||||||
|
branch means that the assertion has failed. If the assertion is being
|
||||||
|
used as a condition in a conditional subpattern (see below), captured
|
||||||
|
substrings are retained, because matching continues with the "no"
|
||||||
|
branch of the condition. For other failing negative assertions, control
|
||||||
|
passes to the previous backtracking point, thus discarding any captured
|
||||||
|
strings within the assertion.
|
||||||
|
|
||||||
For compatibility with Perl, most assertion subpatterns may be
|
For compatibility with Perl, most assertion subpatterns may be
|
||||||
repeated; though it makes no sense to assert the same thing several
|
repeated; though it makes no sense to assert the same thing several
|
||||||
|
@ -8007,8 +8017,9 @@ CONDITIONAL SUBPATTERNS
|
||||||
(?(condition)yes-pattern|no-pattern)
|
(?(condition)yes-pattern|no-pattern)
|
||||||
|
|
||||||
If the condition is satisfied, the yes-pattern is used; otherwise the
|
If the condition is satisfied, the yes-pattern is used; otherwise the
|
||||||
no-pattern (if present) is used. If there are more than two alterna-
|
no-pattern (if present) is used. An absent no-pattern is equivalent to
|
||||||
tives in the subpattern, a compile-time error occurs. Each of the two
|
an empty string (it always matches). If there are more than two alter-
|
||||||
|
natives in the subpattern, a compile-time error occurs. Each of the two
|
||||||
alternatives may itself contain nested subpatterns of any form, includ-
|
alternatives may itself contain nested subpatterns of any form, includ-
|
||||||
ing conditional subpatterns; the restriction to two alternatives
|
ing conditional subpatterns; the restriction to two alternatives
|
||||||
applies only at the level of the condition. This pattern fragment is an
|
applies only at the level of the condition. This pattern fragment is an
|
||||||
|
@ -8943,7 +8954,7 @@ AUTHOR
|
||||||
|
|
||||||
REVISION
|
REVISION
|
||||||
|
|
||||||
Last updated: 07 July 2018
|
Last updated: 10 July 2018
|
||||||
Copyright (c) 1997-2018 University of Cambridge.
|
Copyright (c) 1997-2018 University of Cambridge.
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH PCRE2PATTERN 3 "07 July 2018" "PCRE2 10.32"
|
.TH PCRE2PATTERN 3 "10 July 2018" "PCRE2 10.32"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
PCRE2 - Perl-compatible regular expressions (revised API)
|
PCRE2 - Perl-compatible regular expressions (revised API)
|
||||||
.SH "PCRE2 REGULAR EXPRESSION DETAILS"
|
.SH "PCRE2 REGULAR EXPRESSION DETAILS"
|
||||||
|
@ -2292,25 +2292,35 @@ those that look ahead of the current position in the subject string, and those
|
||||||
that look behind it, and in each case an assertion may be positive (must
|
that look behind it, and in each case an assertion may be positive (must
|
||||||
succeed for matching to continue) or negative (must not succeed for matching to
|
succeed for matching to continue) or negative (must not succeed for matching to
|
||||||
continue). An assertion subpattern is matched in the normal way, except that,
|
continue). An assertion subpattern is matched in the normal way, except that,
|
||||||
when matching continues afterwards, the matching position in the subject string
|
when matching continues after a successful assertion, the matching position in
|
||||||
is as it was at the start of the assertion.
|
the subject string is as it was before the assertion was processed.
|
||||||
.P
|
.P
|
||||||
Assertion subpatterns are not capturing subpatterns. If an assertion contains
|
Assertion subpatterns are not capturing subpatterns. If an assertion contains
|
||||||
capturing subpatterns within it, these are counted for the purposes of
|
capturing subpatterns within it, these are counted for the purposes of
|
||||||
numbering the capturing subpatterns in the whole pattern. However, substring
|
numbering the capturing subpatterns in the whole pattern. Within each branch of
|
||||||
capturing is carried out only for positive assertions that succeed, that is,
|
an assertion, locally captured substrings may be referenced in the usual way.
|
||||||
one of their branches matches, so matching continues after the assertion. If
|
For example, a sequence such as (.)\eg{-1} can be used to check that two
|
||||||
all branches of a positive assertion fail to match, nothing is captured, and
|
adjacent characters are the same.
|
||||||
control is passed to the previous backtracking point.
|
|
||||||
.P
|
.P
|
||||||
No capturing is done for a negative assertion unless it is being used as a
|
When a branch within an assertion fails to match, any substrings that were
|
||||||
condition in a
|
captured are discarded (as happens with any pattern branch that fails to
|
||||||
.\" HTML <a href="#subpatternsassubroutines">
|
match). A negative assertion succeeds only when all its branches fail to match;
|
||||||
|
this means that no captured substrings are ever retained after a successful
|
||||||
|
negative assertion. When an assertion contains a matching branch, what happens
|
||||||
|
depends on the type of assertion.
|
||||||
|
.P
|
||||||
|
For a positive assertion, internally captured substrings in the successful
|
||||||
|
branch are retained, and matching continues with the next pattern item after
|
||||||
|
the assertion. For a negative assertion, a matching branch means that the
|
||||||
|
assertion has failed. If the assertion is being used as a condition in a
|
||||||
|
.\" HTML <a href="#conditions">
|
||||||
.\" </a>
|
.\" </a>
|
||||||
conditional subpattern
|
conditional subpattern
|
||||||
.\"
|
.\"
|
||||||
(see the discussion below). Matching continues after a non-conditional negative
|
(see below), captured substrings are retained, because matching continues with
|
||||||
assertion only if all its branches fail to match.
|
the "no" branch of the condition. For other failing negative assertions,
|
||||||
|
control passes to the previous backtracking point, thus discarding any captured
|
||||||
|
strings within the assertion.
|
||||||
.P
|
.P
|
||||||
For compatibility with Perl, most assertion subpatterns may be repeated; though
|
For compatibility with Perl, most assertion subpatterns may be repeated; though
|
||||||
it makes no sense to assert the same thing several times, the side effect of
|
it makes no sense to assert the same thing several times, the side effect of
|
||||||
|
@ -2512,7 +2522,8 @@ already been matched. The two possible forms of conditional subpattern are:
|
||||||
(?(condition)yes-pattern|no-pattern)
|
(?(condition)yes-pattern|no-pattern)
|
||||||
.sp
|
.sp
|
||||||
If the condition is satisfied, the yes-pattern is used; otherwise the
|
If the condition is satisfied, the yes-pattern is used; otherwise the
|
||||||
no-pattern (if present) is used. If there are more than two alternatives in the
|
no-pattern (if present) is used. An absent no-pattern is equivalent to an empty
|
||||||
|
string (it always matches). If there are more than two alternatives in the
|
||||||
subpattern, a compile-time error occurs. Each of the two alternatives may
|
subpattern, a compile-time error occurs. Each of the two alternatives may
|
||||||
itself contain nested subpatterns of any form, including conditional
|
itself contain nested subpatterns of any form, including conditional
|
||||||
subpatterns; the restriction to two alternatives applies only at the level of
|
subpatterns; the restriction to two alternatives applies only at the level of
|
||||||
|
@ -3525,6 +3536,6 @@ Cambridge, England.
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
Last updated: 07 July 2018
|
Last updated: 10 July 2018
|
||||||
Copyright (c) 1997-2018 University of Cambridge.
|
Copyright (c) 1997-2018 University of Cambridge.
|
||||||
.fi
|
.fi
|
||||||
|
|
Loading…
Reference in New Issue