mirror of
https://github.com/PCRE2Project/pcre2.git
synced 2025-10-20 04:25:35 +08:00
Update HTML and plain text documentation
This commit is contained in:
@@ -16,10 +16,10 @@ please consult the man page, in case the conversion went wrong.
|
||||
DIFFERENCES BETWEEN PCRE2 AND PERL
|
||||
</b><br>
|
||||
<P>
|
||||
This document describes some of the differences in the ways that PCRE2 and Perl
|
||||
handle regular expressions. The differences described here are with respect to
|
||||
Perl version 5.34.0, but as both Perl and PCRE2 are continually changing, the
|
||||
information may at times be out of date.
|
||||
This document describes some of the known differences in the ways that PCRE2
|
||||
and Perl handle regular expressions. The differences described here are with
|
||||
respect to Perl version 5.34.0, but as both Perl and PCRE2 are continually
|
||||
changing, the information may at times be out of date.
|
||||
</P>
|
||||
<P>
|
||||
1. When PCRE2_DOTALL (equivalent to Perl's /s qualifier) is not set, the
|
||||
@@ -173,59 +173,48 @@ of which (such as named parentheses) were in PCRE2 for some time before. This
|
||||
list is with respect to Perl 5.34:
|
||||
<br>
|
||||
<br>
|
||||
(a) Although lookbehind assertions in PCRE2 must match fixed length strings,
|
||||
each alternative toplevel branch of a lookbehind assertion can match a
|
||||
different length of string. Perl used to require them all to have the same
|
||||
length, but the latest version has some variable length support.
|
||||
<br>
|
||||
<br>
|
||||
(b) From PCRE2 10.23, backreferences to groups of fixed length are supported
|
||||
in lookbehinds, provided that there is no possibility of referencing a
|
||||
non-unique number or name. Perl does not support backreferences in lookbehinds.
|
||||
<br>
|
||||
<br>
|
||||
(c) If PCRE2_DOLLAR_ENDONLY is set and PCRE2_MULTILINE is not set, the $
|
||||
(a) If PCRE2_DOLLAR_ENDONLY is set and PCRE2_MULTILINE is not set, the $
|
||||
meta-character matches only at the very end of the string.
|
||||
<br>
|
||||
<br>
|
||||
(d) A backslash followed by a letter with no special meaning is faulted. (Perl
|
||||
(b) A backslash followed by a letter with no special meaning is faulted. (Perl
|
||||
can be made to issue a warning.)
|
||||
<br>
|
||||
<br>
|
||||
(e) If PCRE2_UNGREEDY is set, the greediness of the repetition quantifiers is
|
||||
(c) If PCRE2_UNGREEDY is set, the greediness of the repetition quantifiers is
|
||||
inverted, that is, by default they are not greedy, but if followed by a
|
||||
question mark they are.
|
||||
<br>
|
||||
<br>
|
||||
(f) PCRE2_ANCHORED can be used at matching time to force a pattern to be tried
|
||||
(d) PCRE2_ANCHORED can be used at matching time to force a pattern to be tried
|
||||
only at the first matching position in the subject string.
|
||||
<br>
|
||||
<br>
|
||||
(g) The PCRE2_NOTBOL, PCRE2_NOTEOL, PCRE2_NOTEMPTY and PCRE2_NOTEMPTY_ATSTART
|
||||
(e) The PCRE2_NOTBOL, PCRE2_NOTEOL, PCRE2_NOTEMPTY and PCRE2_NOTEMPTY_ATSTART
|
||||
options have no Perl equivalents.
|
||||
<br>
|
||||
<br>
|
||||
(h) The \R escape sequence can be restricted to match only CR, LF, or CRLF
|
||||
(f) The \R escape sequence can be restricted to match only CR, LF, or CRLF
|
||||
by the PCRE2_BSR_ANYCRLF option.
|
||||
<br>
|
||||
<br>
|
||||
(i) The callout facility is PCRE2-specific. Perl supports codeblocks and
|
||||
(g) The callout facility is PCRE2-specific. Perl supports codeblocks and
|
||||
variable interpolation, but not general hooks on every match.
|
||||
<br>
|
||||
<br>
|
||||
(j) The partial matching facility is PCRE2-specific.
|
||||
(h) The partial matching facility is PCRE2-specific.
|
||||
<br>
|
||||
<br>
|
||||
(k) The alternative matching function (<b>pcre2_dfa_match()</b> matches in a
|
||||
(i) The alternative matching function (<b>pcre2_dfa_match()</b> matches in a
|
||||
different way and is not Perl-compatible.
|
||||
<br>
|
||||
<br>
|
||||
(l) PCRE2 recognizes some special sequences such as (*CR) or (*NO_JIT) at
|
||||
(j) PCRE2 recognizes some special sequences such as (*CR) or (*NO_JIT) at
|
||||
the start of a pattern. These set overall options that cannot be changed within
|
||||
the pattern.
|
||||
<br>
|
||||
<br>
|
||||
(m) PCRE2 supports non-atomic positive lookaround assertions. This is an
|
||||
(k) PCRE2 supports non-atomic positive lookaround assertions. This is an
|
||||
extension to the lookaround facilities. The default, Perl-compatible
|
||||
lookarounds are atomic.
|
||||
</P>
|
||||
@@ -252,7 +241,7 @@ Cambridge, England.
|
||||
REVISION
|
||||
</b><br>
|
||||
<P>
|
||||
Last updated: 03 February 2023
|
||||
Last updated: 11 August 2023
|
||||
<br>
|
||||
Copyright © 1997-2023 University of Cambridge.
|
||||
<br>
|
||||
|
Reference in New Issue
Block a user