6 |
.sp |
.sp |
7 |
This document describes the differences in the ways that PCRE and Perl handle |
This document describes the differences in the ways that PCRE and Perl handle |
8 |
regular expressions. The differences described here are mainly with respect to |
regular expressions. The differences described here are mainly with respect to |
9 |
Perl 5.8, though PCRE version 7.0 contains some features that are expected to |
Perl 5.8, though PCRE versions 7.0 and later contain some features that are |
10 |
be in the forthcoming Perl 5.10. |
expected to be in the forthcoming Perl 5.10. |
11 |
.P |
.P |
12 |
1. PCRE has only a subset of Perl's UTF-8 and Unicode support. Details of what |
1. PCRE has only a subset of Perl's UTF-8 and Unicode support. Details of what |
13 |
it does have are given in the |
it does have are given in the |
81 |
strings when part of a pattern is repeated. For example, matching "aba" against |
strings when part of a pattern is repeated. For example, matching "aba" against |
82 |
the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE it is set to "b". |
the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE it is set to "b". |
83 |
.P |
.P |
84 |
11. PCRE provides some extensions to the Perl regular expression facilities. |
11. PCRE does support Perl 5.10's backtracking verbs (*ACCEPT), (*FAIL), (*F), |
85 |
|
(*COMMIT), (*PRUNE), (*SKIP), and (*THEN), but only in the forms without an |
86 |
|
argument. PCRE does not support (*MARK). If (*ACCEPT) is within capturing |
87 |
|
parentheses, PCRE does not set that capture group; this is different to Perl. |
88 |
|
.P |
89 |
|
12. PCRE provides some extensions to the Perl regular expression facilities. |
90 |
Perl 5.10 will include new features that are not in earlier versions, some of |
Perl 5.10 will include new features that are not in earlier versions, some of |
91 |
which (such as named parentheses) have been in PCRE for some time. This list is |
which (such as named parentheses) have been in PCRE for some time. This list is |
92 |
with respect to Perl 5.10: |
with respect to Perl 5.10: |
99 |
meta-character matches only at the very end of the string. |
meta-character matches only at the very end of the string. |
100 |
.sp |
.sp |
101 |
(c) If PCRE_EXTRA is set, a backslash followed by a letter with no special |
(c) If PCRE_EXTRA is set, a backslash followed by a letter with no special |
102 |
meaning is faulted. Otherwise, like Perl, the backslash is ignored. (Perl can |
meaning is faulted. Otherwise, like Perl, the backslash is quietly ignored. |
103 |
be made to issue a warning.) |
(Perl can be made to issue a warning.) |
104 |
.sp |
.sp |
105 |
(d) If PCRE_UNGREEDY is set, the greediness of the repetition quantifiers is |
(d) If PCRE_UNGREEDY is set, the greediness of the repetition quantifiers is |
106 |
inverted, that is, by default they are not greedy, but if followed by a |
inverted, that is, by default they are not greedy, but if followed by a |
137 |
.rs |
.rs |
138 |
.sp |
.sp |
139 |
.nf |
.nf |
140 |
Last updated: 06 March 2007 |
Last updated: 08 August 2007 |
141 |
Copyright (c) 1997-2007 University of Cambridge. |
Copyright (c) 1997-2007 University of Cambridge. |
142 |
.fi |
.fi |