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>
|
||||||
|
|
805
doc/pcre2.txt
805
doc/pcre2.txt
File diff suppressed because it is too large
Load Diff
|
@ -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