| 95 |
documentation for details. |
documentation for details. |
| 96 |
</P> |
</P> |
| 97 |
<P> |
<P> |
| 98 |
10. Subpatterns that are called recursively or as "subroutines" are always |
10. Subpatterns that are called as subroutines (whether or not recursively) are |
| 99 |
treated as atomic groups in PCRE. This is like Python, but unlike Perl. There |
always treated as atomic groups in PCRE. This is like Python, but unlike Perl. |
| 100 |
is a discussion of an example that explains this in more detail in the |
Captured values that are set outside a subroutine call can be reference from |
| 101 |
|
inside in PCRE, but not in Perl. There is a discussion that explains these |
| 102 |
|
differences in more detail in the |
| 103 |
<a href="pcrepattern.html#recursiondifference">section on recursion differences from Perl</a> |
<a href="pcrepattern.html#recursiondifference">section on recursion differences from Perl</a> |
| 104 |
in the |
in the |
| 105 |
<a href="pcrepattern.html"><b>pcrepattern</b></a> |
<a href="pcrepattern.html"><b>pcrepattern</b></a> |
| 106 |
page. |
page. |
| 107 |
</P> |
</P> |
| 108 |
<P> |
<P> |
| 109 |
11. There are some differences that are concerned with the settings of captured |
11. If (*THEN) is present in a group that is called as a subroutine, its action |
| 110 |
|
is limited to that group, even if the group does not contain any | characters. |
| 111 |
|
</P> |
| 112 |
|
<P> |
| 113 |
|
12. There are some differences that are concerned with the settings of captured |
| 114 |
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 |
| 115 |
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". |
| 116 |
</P> |
</P> |
| 117 |
<P> |
<P> |
| 118 |
12. PCRE's handling of duplicate subpattern numbers and duplicate subpattern |
13. PCRE's handling of duplicate subpattern numbers and duplicate subpattern |
| 119 |
names is not as general as Perl's. This is a consequence of the fact the PCRE |
names is not as general as Perl's. This is a consequence of the fact the PCRE |
| 120 |
works internally just with numbers, using an external table to translate |
works internally just with numbers, using an external table to translate |
| 121 |
between numbers and names. In particular, a pattern such as (?|(?<a>A)|(?<b)B), |
between numbers and names. In particular, a pattern such as (?|(?<a>A)|(?<b)B), |
| 126 |
an error is given at compile time. |
an error is given at compile time. |
| 127 |
</P> |
</P> |
| 128 |
<P> |
<P> |
| 129 |
13. Perl recognizes comments in some places that PCRE does not, for example, |
14. Perl recognizes comments in some places that PCRE does not, for example, |
| 130 |
between the ( and ? at the start of a subpattern. If the /x modifier is set, |
between the ( and ? at the start of a subpattern. If the /x modifier is set, |
| 131 |
Perl allows whitespace between ( and ? but PCRE never does, even if the |
Perl allows whitespace between ( and ? but PCRE never does, even if the |
| 132 |
PCRE_EXTENDED option is set. |
PCRE_EXTENDED option is set. |
| 133 |
</P> |
</P> |
| 134 |
<P> |
<P> |
| 135 |
14. PCRE provides some extensions to the Perl regular expression facilities. |
15. PCRE provides some extensions to the Perl regular expression facilities. |
| 136 |
Perl 5.10 includes new features that are not in earlier versions of Perl, some |
Perl 5.10 includes new features that are not in earlier versions of Perl, some |
| 137 |
of which (such as named parentheses) have been in PCRE for some time. This list |
of which (such as named parentheses) have been in PCRE for some time. This list |
| 138 |
is with respect to Perl 5.10: |
is with respect to Perl 5.10: |
| 176 |
<br> |
<br> |
| 177 |
<br> |
<br> |
| 178 |
(j) Patterns compiled by PCRE can be saved and re-used at a later time, even on |
(j) Patterns compiled by PCRE can be saved and re-used at a later time, even on |
| 179 |
different hosts that have the other endianness. |
different hosts that have the other endianness. However, this does not apply to |
| 180 |
|
optimized data created by the just-in-time compiler. |
| 181 |
<br> |
<br> |
| 182 |
<br> |
<br> |
| 183 |
(k) 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 |
| 202 |
REVISION |
REVISION |
| 203 |
</b><br> |
</b><br> |
| 204 |
<P> |
<P> |
| 205 |
Last updated: 24 August 2011 |
Last updated: 09 October 2011 |
| 206 |
<br> |
<br> |
| 207 |
Copyright © 1997-2011 University of Cambridge. |
Copyright © 1997-2011 University of Cambridge. |
| 208 |
<br> |
<br> |