Documentation update regarding \Q handling.
This commit is contained in:
parent
a9453f096f
commit
27337495dc
|
@ -1,4 +1,4 @@
|
||||||
.TH PCRE2COMPAT 3 "27 July 2018" "PCRE2 10.32"
|
.TH PCRE2COMPAT 3 "28 July 2018" "PCRE2 10.32"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
PCRE2 - Perl-compatible regular expressions (revised API)
|
PCRE2 - Perl-compatible regular expressions (revised API)
|
||||||
.SH "DIFFERENCES BETWEEN PCRE2 AND PERL"
|
.SH "DIFFERENCES BETWEEN PCRE2 AND PERL"
|
||||||
|
@ -29,12 +29,13 @@ assertion is a condition that has a matching branch (that is, the condition is
|
||||||
false).
|
false).
|
||||||
.P
|
.P
|
||||||
4. The following Perl escape sequences are not supported: \eF, \el, \eL, \eu,
|
4. The following Perl escape sequences are not supported: \eF, \el, \eL, \eu,
|
||||||
\eU, and \eN when followed by a character name. (\eN on its own, matching a
|
\eU, and \eN when followed by a character name. \eN on its own, matching a
|
||||||
non-newline character, is supported.) The escapes that modify the case of
|
non-newline character, and \eN{U+dd..}, matching a Unicode code point, are
|
||||||
following letters are implemented by Perl's general string-handling and are not
|
supported. The escapes that modify the case of following letters are
|
||||||
part of its pattern matching engine. If any of these are encountered by PCRE2,
|
implemented by Perl's general string-handling and are not part of its pattern
|
||||||
an error is generated by default. However, if the PCRE2_ALT_BSUX option is set,
|
matching engine. If any of these are encountered by PCRE2, an error is
|
||||||
\eU and \eu are interpreted as ECMAScript interprets them.
|
generated by default. However, if the PCRE2_ALT_BSUX option is set, \eU and \eu
|
||||||
|
are interpreted as ECMAScript interprets them.
|
||||||
.P
|
.P
|
||||||
5. The Perl escape sequences \ep, \eP, and \eX are supported only if PCRE2 is
|
5. The Perl escape sequences \ep, \eP, and \eX are supported only if PCRE2 is
|
||||||
built with Unicode support (the default). The properties that can be tested
|
built with Unicode support (the default). The properties that can be tested
|
||||||
|
@ -45,19 +46,24 @@ documentation says "Because Perl hides the need for the user to understand the
|
||||||
internal representation of Unicode characters, there is no need to implement
|
internal representation of Unicode characters, there is no need to implement
|
||||||
the somewhat messy concept of surrogates."
|
the somewhat messy concept of surrogates."
|
||||||
.P
|
.P
|
||||||
6. PCRE2 does support the \eQ...\eE escape for quoting substrings. Characters
|
6. PCRE2 supports the \eQ...\eE escape for quoting substrings. Characters
|
||||||
in between are treated as literals. This is slightly different from Perl in
|
in between are treated as literals. However, this is slightly different from
|
||||||
that $ and @ are also handled as literals inside the quotes. In Perl, they
|
Perl in that $ and @ are also handled as literals inside the quotes. In Perl,
|
||||||
cause variable interpolation (but of course PCRE2 does not have variables).
|
they cause variable interpolation (but of course PCRE2 does not have
|
||||||
Note the following examples:
|
variables). Also, Perl does "double-quotish backslash interpolation" on any
|
||||||
|
backslashes between \eQ and \eE which, its documentation says, "may lead to
|
||||||
|
confusing results". PCRE2 treats a backslash between \eQ and \eE just like any
|
||||||
|
other character. Note the following examples:
|
||||||
.sp
|
.sp
|
||||||
Pattern PCRE2 matches Perl matches
|
Pattern PCRE2 matches Perl matches
|
||||||
.sp
|
.sp
|
||||||
.\" JOIN
|
.\" JOIN
|
||||||
\eQabc$xyz\eE abc$xyz abc followed by the
|
\eQabc$xyz\eE abc$xyz abc followed by the
|
||||||
contents of $xyz
|
contents of $xyz
|
||||||
\eQabc\e$xyz\eE abc\e$xyz abc\e$xyz
|
\eQabc\e$xyz\eE abc\e$xyz abc\e$xyz
|
||||||
\eQabc\eE\e$\eQxyz\eE abc$xyz abc$xyz
|
\eQabc\eE\e$\eQxyz\eE abc$xyz abc$xyz
|
||||||
|
\eQA\eB\eE A\eB A\eB
|
||||||
|
\eQ\e\eE \e \e\eE
|
||||||
.sp
|
.sp
|
||||||
The \eQ...\eE sequence is recognized both inside and outside character classes.
|
The \eQ...\eE sequence is recognized both inside and outside character classes.
|
||||||
.P
|
.P
|
||||||
|
@ -194,6 +200,6 @@ Cambridge, England.
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
Last updated: 27 July 2018
|
Last updated: 28 July 2018
|
||||||
Copyright (c) 1997-2018 University of Cambridge.
|
Copyright (c) 1997-2018 University of Cambridge.
|
||||||
.fi
|
.fi
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH PCRE2PATTERN 3 "27 July 2018" "PCRE2 10.32"
|
.TH PCRE2PATTERN 3 "28 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"
|
||||||
|
@ -331,7 +331,10 @@ of the pattern.
|
||||||
If you want to remove the special meaning from a sequence of characters, you
|
If you want to remove the special meaning from a sequence of characters, you
|
||||||
can do so by putting them between \eQ and \eE. This is different from Perl in
|
can do so by putting them between \eQ and \eE. This is different from Perl in
|
||||||
that $ and @ are handled as literals in \eQ...\eE sequences in PCRE2, whereas
|
that $ and @ are handled as literals in \eQ...\eE sequences in PCRE2, whereas
|
||||||
in Perl, $ and @ cause variable interpolation. Note the following examples:
|
in Perl, $ and @ cause variable interpolation. Also, Perl does "double-quotish
|
||||||
|
backslash interpolation" on any backslashes between \eQ and \eE which, its
|
||||||
|
documentation says, "may lead to confusing results". PCRE2 treats a backslash
|
||||||
|
between \eQ and \eE just like any other character. Note the following examples:
|
||||||
.sp
|
.sp
|
||||||
Pattern PCRE2 matches Perl matches
|
Pattern PCRE2 matches Perl matches
|
||||||
.sp
|
.sp
|
||||||
|
@ -340,6 +343,8 @@ in Perl, $ and @ cause variable interpolation. Note the following examples:
|
||||||
contents of $xyz
|
contents of $xyz
|
||||||
\eQabc\e$xyz\eE abc\e$xyz abc\e$xyz
|
\eQabc\e$xyz\eE abc\e$xyz abc\e$xyz
|
||||||
\eQabc\eE\e$\eQxyz\eE abc$xyz abc$xyz
|
\eQabc\eE\e$\eQxyz\eE abc$xyz abc$xyz
|
||||||
|
\eQA\eB\eE A\eB A\eB
|
||||||
|
\eQ\e\eE \e \e\eE
|
||||||
.sp
|
.sp
|
||||||
The \eQ...\eE sequence is recognized both inside and outside character classes.
|
The \eQ...\eE sequence is recognized both inside and outside character classes.
|
||||||
An isolated \eE that is not preceded by \eQ is ignored. If \eQ is not followed
|
An isolated \eE that is not preceded by \eQ is ignored. If \eQ is not followed
|
||||||
|
@ -3604,6 +3609,6 @@ Cambridge, England.
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
Last updated: 27 July 2018
|
Last updated: 28 July 2018
|
||||||
Copyright (c) 1997-2018 University of Cambridge.
|
Copyright (c) 1997-2018 University of Cambridge.
|
||||||
.fi
|
.fi
|
||||||
|
|
Loading…
Reference in New Issue