Documentation update.
This commit is contained in:
parent
40582cf377
commit
89a834b75e
|
@ -1,4 +1,4 @@
|
||||||
.TH PCRE2_GET_MARK 3 "24 October 2014" "PCRE2 10.00"
|
.TH PCRE2_GET_MARK 3 "13 October 2017" "PCRE2 10.31"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
PCRE2 - Perl-compatible regular expressions (revised API)
|
PCRE2 - Perl-compatible regular expressions (revised API)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -14,11 +14,14 @@ PCRE2 - Perl-compatible regular expressions (revised API)
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
After a call of \fBpcre2_match()\fP that was passed the match block that is
|
After a call of \fBpcre2_match()\fP that was passed the match block that is
|
||||||
this function's argument, this function returns a pointer to the last (*MARK)
|
this function's argument, this function returns a pointer to the last (*MARK),
|
||||||
name that was encountered. The name is zero-terminated, and is within the
|
(*PRUNE), or (*THEN) name that was encountered during the matching process. The
|
||||||
compiled pattern. If no (*MARK) name is available, NULL is returned. A (*MARK)
|
name is zero-terminated, and is within the compiled pattern. The length of the
|
||||||
name may be available after a failed match or a partial match, as well as after
|
name is in the preceding code unit. If no name is available, NULL is returned.
|
||||||
a successful one.
|
.P
|
||||||
|
After a successful match, the name that is returned is the last one on the
|
||||||
|
matching path. After a failed match or a partial match, the last encountered
|
||||||
|
name is returned.
|
||||||
.P
|
.P
|
||||||
There is a complete description of the PCRE2 native API in the
|
There is a complete description of the PCRE2 native API in the
|
||||||
.\" HREF
|
.\" HREF
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH PCRE2API 3 "25 September 2017" "PCRE2 10.31"
|
.TH PCRE2API 3 "13 October 2017" "PCRE2 10.31"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
PCRE2 - Perl-compatible regular expressions (revised API)
|
PCRE2 - Perl-compatible regular expressions (revised API)
|
||||||
.sp
|
.sp
|
||||||
|
@ -2717,24 +2717,27 @@ appropriate circumstances. If they are called at other times, the result is
|
||||||
undefined.
|
undefined.
|
||||||
.P
|
.P
|
||||||
After a successful match, a partial match (PCRE2_ERROR_PARTIAL), or a failure
|
After a successful match, a partial match (PCRE2_ERROR_PARTIAL), or a failure
|
||||||
to match (PCRE2_ERROR_NOMATCH), a (*MARK) name may be available, and
|
to match (PCRE2_ERROR_NOMATCH), a (*MARK), (*PRUNE), or (*THEN) name may be
|
||||||
\fBpcre2_get_mark()\fP can be called. It returns a pointer to the
|
available. The function \fBpcre2_get_mark()\fP can be called to access this
|
||||||
zero-terminated name, which is within the compiled pattern. Otherwise NULL is
|
name. The same function applies to all three verbs. It returns a pointer to the
|
||||||
returned. The length of the (*MARK) name (excluding the terminating zero) is
|
zero-terminated name, which is within the compiled pattern. If no name is
|
||||||
stored in the code unit that preceeds the name. You should use this instead of
|
available, NULL is returned. The length of the name (excluding the terminating
|
||||||
relying on the terminating zero if the (*MARK) name might contain a binary
|
zero) is stored in the code unit that precedes the name. You should use this
|
||||||
zero.
|
length instead of relying on the terminating zero if the name might contain a
|
||||||
|
binary zero.
|
||||||
.P
|
.P
|
||||||
After a successful match, the (*MARK) name that is returned is the
|
After a successful match, the name that is returned is the last (*MARK),
|
||||||
last one encountered on the matching path through the pattern. After a "no
|
(*PRUNE), or (*THEN) name encountered on the matching path through the pattern.
|
||||||
match" or a partial match, the last encountered (*MARK) name is returned. For
|
Instances of (*PRUNE) and (*THEN) without names are ignored. Thus, for example,
|
||||||
example, consider this pattern:
|
if the matching path contains (*MARK:A)(*PRUNE), the name "A" is returned.
|
||||||
|
After a "no match" or a partial match, the last encountered name is returned.
|
||||||
|
For example, consider this pattern:
|
||||||
.sp
|
.sp
|
||||||
^(*MARK:A)((*MARK:B)a|b)c
|
^(*MARK:A)((*MARK:B)a|b)c
|
||||||
.sp
|
.sp
|
||||||
When it matches "bc", the returned mark is A. The B mark is "seen" in the first
|
When it matches "bc", the returned name is A. The B mark is "seen" in the first
|
||||||
branch of the group, but it is not on the matching path. On the other hand,
|
branch of the group, but it is not on the matching path. On the other hand,
|
||||||
when this pattern fails to match "bx", the returned mark is B.
|
when this pattern fails to match "bx", the returned name is B.
|
||||||
.P
|
.P
|
||||||
After a successful match, a partial match, or one of the invalid UTF errors
|
After a successful match, a partial match, or one of the invalid UTF errors
|
||||||
(for example, PCRE2_ERROR_UTF8_ERR5), \fBpcre2_get_startchar()\fP can be
|
(for example, PCRE2_ERROR_UTF8_ERR5), \fBpcre2_get_startchar()\fP can be
|
||||||
|
@ -3135,12 +3138,12 @@ length is in code units, not bytes.
|
||||||
In the replacement string, which is interpreted as a UTF string in UTF mode,
|
In the replacement string, which is interpreted as a UTF string in UTF mode,
|
||||||
and is checked for UTF validity unless the PCRE2_NO_UTF_CHECK option is set, a
|
and is checked for UTF validity unless the PCRE2_NO_UTF_CHECK option is set, a
|
||||||
dollar character is an escape character that can specify the insertion of
|
dollar character is an escape character that can specify the insertion of
|
||||||
characters from capturing groups or (*MARK) items in the pattern. The following
|
characters from capturing groups or (*MARK), (*PRUNE), or (*THEN) items in the
|
||||||
forms are always recognized:
|
pattern. The following forms are always recognized:
|
||||||
.sp
|
.sp
|
||||||
$$ insert a dollar character
|
$$ insert a dollar character
|
||||||
$<n> or ${<n>} insert the contents of group <n>
|
$<n> or ${<n>} insert the contents of group <n>
|
||||||
$*MARK or ${*MARK} insert the name of the last (*MARK) encountered
|
$*MARK or ${*MARK} insert a (*MARK), (*PRUNE), or (*THEN) name
|
||||||
.sp
|
.sp
|
||||||
Either a group number or a group name can be given for <n>. Curly brackets are
|
Either a group number or a group name can be given for <n>. Curly brackets are
|
||||||
required only if the following character would be interpreted as part of the
|
required only if the following character would be interpreted as part of the
|
||||||
|
@ -3148,15 +3151,19 @@ number or name. The number may be zero to include the entire matched string.
|
||||||
For example, if the pattern a(b)c is matched with "=abc=" and the replacement
|
For example, if the pattern a(b)c is matched with "=abc=" and the replacement
|
||||||
string "+$1$0$1+", the result is "=+babcb+=".
|
string "+$1$0$1+", the result is "=+babcb+=".
|
||||||
.P
|
.P
|
||||||
The facility for inserting a (*MARK) name can be used to perform simple
|
$*MARK inserts the name from the last encountered (*MARK), (*PRUNE), or (*THEN)
|
||||||
simultaneous substitutions, as this \fBpcre2test\fP example shows:
|
on the matching path that has a name. (*MARK) must always include a name, but
|
||||||
|
(*PRUNE) and (*THEN) need not. For example, in the case of (*MARK:A)(*PRUNE)
|
||||||
|
the name inserted is "A", but for (*MARK:A)(*PRUNE:B) the relevant name is "B".
|
||||||
|
This facility can be used to perform simple simultaneous substitutions, as this
|
||||||
|
\fBpcre2test\fP example shows:
|
||||||
.sp
|
.sp
|
||||||
/(*:pear)apple|(*:orange)lemon/g,replace=${*MARK}
|
/(*MARK:pear)apple|(*MARK:orange)lemon/g,replace=${*MARK}
|
||||||
apple lemon
|
apple lemon
|
||||||
2: pear orange
|
2: pear orange
|
||||||
.sp
|
.sp
|
||||||
As well as the usual options for \fBpcre2_match()\fP, a number of additional
|
As well as the usual options for \fBpcre2_match()\fP, a number of additional
|
||||||
options can be set in the \fIoptions\fP argument.
|
options can be set in the \fIoptions\fP argument of \fBpcre2_substitute()\fP.
|
||||||
.P
|
.P
|
||||||
PCRE2_SUBSTITUTE_GLOBAL causes the function to iterate over the subject string,
|
PCRE2_SUBSTITUTE_GLOBAL causes the function to iterate over the subject string,
|
||||||
replacing every matching substring. If this is not set, only the first matching
|
replacing every matching substring. If this is not set, only the first matching
|
||||||
|
@ -3573,6 +3580,6 @@ Cambridge, England.
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
Last updated: 25 September 2017
|
Last updated: 13 October 2017
|
||||||
Copyright (c) 1997-2017 University of Cambridge.
|
Copyright (c) 1997-2017 University of Cambridge.
|
||||||
.fi
|
.fi
|
||||||
|
|
Loading…
Reference in New Issue