| 7 |
<p> |
<p> |
| 8 |
Return to the <a href="index.html">PCRE index page</a>. |
Return to the <a href="index.html">PCRE index page</a>. |
| 9 |
</p> |
</p> |
| 10 |
<p> |
<p> |
| 11 |
This page is part of the PCRE HTML documentation. It was generated automatically |
This page is part of the PCRE HTML documentation. It was generated automatically |
| 12 |
from the original man page. If there is any nonsense in it, please consult the |
from the original man page. If there is any nonsense in it, please consult the |
| 13 |
man page, in case the conversion went wrong. |
man page, in case the conversion went wrong. |
| 14 |
<br> |
<br> |
| 15 |
<br><b> |
<br><b> |
| 16 |
DIFFERENCES BETWEEN PCRE AND PERL |
DIFFERENCES BETWEEN PCRE AND PERL |
| 17 |
</b><br> |
</b><br> |
| 18 |
<P> |
<P> |
| 19 |
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 |
| 20 |
regular expressions. The differences described here are mainly with respect to |
regular expressions. The differences described here are mainly with respect to |
| 21 |
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 |
| 22 |
be in the forthcoming Perl 5.10. |
expected to be in the forthcoming Perl 5.10. |
| 23 |
</P> |
</P> |
| 24 |
<P> |
<P> |
| 25 |
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 |
| 95 |
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". |
| 96 |
</P> |
</P> |
| 97 |
<P> |
<P> |
| 98 |
11. PCRE provides some extensions to the Perl regular expression facilities. |
11. PCRE does support Perl 5.10's backtracking verbs (*ACCEPT), (*FAIL), (*F), |
| 99 |
|
(*COMMIT), (*PRUNE), (*SKIP), and (*THEN), but only in the forms without an |
| 100 |
|
argument. PCRE does not support (*MARK). If (*ACCEPT) is within capturing |
| 101 |
|
parentheses, PCRE does not set that capture group; this is different to Perl. |
| 102 |
|
</P> |
| 103 |
|
<P> |
| 104 |
|
12. PCRE provides some extensions to the Perl regular expression facilities. |
| 105 |
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 |
| 106 |
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 |
| 107 |
with respect to Perl 5.10: |
with respect to Perl 5.10: |
| 117 |
<br> |
<br> |
| 118 |
<br> |
<br> |
| 119 |
(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 |
| 120 |
meaning is faulted. Otherwise, like Perl, the backslash is ignored. (Perl can |
meaning is faulted. Otherwise, like Perl, the backslash is quietly ignored. |
| 121 |
be made to issue a warning.) |
(Perl can be made to issue a warning.) |
| 122 |
<br> |
<br> |
| 123 |
<br> |
<br> |
| 124 |
(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 |
| 134 |
options for <b>pcre_exec()</b> have no Perl equivalents. |
options for <b>pcre_exec()</b> have no Perl equivalents. |
| 135 |
<br> |
<br> |
| 136 |
<br> |
<br> |
| 137 |
(g) The callout facility is PCRE-specific. |
(g) The \R escape sequence can be restricted to match only CR, LF, or CRLF |
| 138 |
|
by the PCRE_BSR_ANYCRLF option. |
| 139 |
<br> |
<br> |
| 140 |
<br> |
<br> |
| 141 |
(h) The partial matching facility is PCRE-specific. |
(h) The callout facility is PCRE-specific. |
| 142 |
<br> |
<br> |
| 143 |
<br> |
<br> |
| 144 |
(i) Patterns compiled by PCRE can be saved and re-used at a later time, even on |
(i) The partial matching facility is PCRE-specific. |
| 145 |
|
<br> |
| 146 |
|
<br> |
| 147 |
|
(j) Patterns compiled by PCRE can be saved and re-used at a later time, even on |
| 148 |
different hosts that have the other endianness. |
different hosts that have the other endianness. |
| 149 |
<br> |
<br> |
| 150 |
<br> |
<br> |
| 151 |
(j) The alternative matching function (<b>pcre_dfa_exec()</b>) matches in a |
(k) The alternative matching function (<b>pcre_dfa_exec()</b>) matches in a |
| 152 |
different way and is not Perl-compatible. |
different way and is not Perl-compatible. |
| 153 |
|
<br> |
| 154 |
|
<br> |
| 155 |
|
(l) PCRE recognizes some special sequences such as (*CR) at the start of |
| 156 |
|
a pattern that set overall options that cannot be changed within the pattern. |
| 157 |
</P> |
</P> |
| 158 |
<br><b> |
<br><b> |
| 159 |
AUTHOR |
AUTHOR |
| 170 |
REVISION |
REVISION |
| 171 |
</b><br> |
</b><br> |
| 172 |
<P> |
<P> |
| 173 |
Last updated: 06 March 2007 |
Last updated: 11 September 2007 |
| 174 |
<br> |
<br> |
| 175 |
Copyright © 1997-2007 University of Cambridge. |
Copyright © 1997-2007 University of Cambridge. |
| 176 |
<br> |
<br> |