/[pcre]/code/trunk/doc/html/pcrecompat.html
ViewVC logotype

Diff of /code/trunk/doc/html/pcrecompat.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 72 by nigel, Sat Feb 24 21:40:03 2007 UTC revision 73 by nigel, Sat Feb 24 21:40:30 2007 UTC
# Line 16  regular expressions. The differences des Line 16  regular expressions. The differences des
16  5.8.  5.8.
17  </P>  </P>
18  <P>  <P>
19  1. PCRE does not allow repeat quantifiers on lookahead assertions. Perl permits  1. PCRE does not have full UTF-8 support. Details of what it does have are
20    given in the
21    <a href="pcre.html#utf8support">section on UTF-8 support</a>
22    in the main
23    <a href="pcre.html"><b>pcre</b></a>
24    page.
25    </P>
26    <P>
27    2. PCRE does not allow repeat quantifiers on lookahead assertions. Perl permits
28  them, but they do not mean what you might think. For example, (?!a){3} does  them, but they do not mean what you might think. For example, (?!a){3} does
29  not assert that the next three characters are not "a". It just asserts that the  not assert that the next three characters are not "a". It just asserts that the
30  next character is not "a" three times.  next character is not "a" three times.
31  </P>  </P>
32  <P>  <P>
33  2. Capturing subpatterns that occur inside negative lookahead assertions are  3. Capturing subpatterns that occur inside negative lookahead assertions are
34  counted, but their entries in the offsets vector are never set. Perl sets its  counted, but their entries in the offsets vector are never set. Perl sets its
35  numerical variables from any such patterns that are matched before the  numerical variables from any such patterns that are matched before the
36  assertion fails to match something (thereby succeeding), but only if the  assertion fails to match something (thereby succeeding), but only if the
37  negative lookahead assertion contains just one branch.  negative lookahead assertion contains just one branch.
38  </P>  </P>
39  <P>  <P>
40  3. Though binary zero characters are supported in the subject string, they are  4. Though binary zero characters are supported in the subject string, they are
41  not allowed in a pattern string because it is passed as a normal C string,  not allowed in a pattern string because it is passed as a normal C string,
42  terminated by zero. The escape sequence "\0" can be used in the pattern to  terminated by zero. The escape sequence "\0" can be used in the pattern to
43  represent a binary zero.  represent a binary zero.
44  </P>  </P>
45  <P>  <P>
46  4. The following Perl escape sequences are not supported: \l, \u, \L,  5. The following Perl escape sequences are not supported: \l, \u, \L,
47  \U, \P, \p, \N, and \X. In fact these are implemented by Perl's general  \U, \P, \p, \N, and \X. In fact these are implemented by Perl's general
48  string-handling and are not part of its pattern matching engine. If any of  string-handling and are not part of its pattern matching engine. If any of
49  these are encountered by PCRE, an error is generated.  these are encountered by PCRE, an error is generated.
50  </P>  </P>
51  <P>  <P>
52  5. PCRE does support the \Q...\E escape for quoting substrings. Characters in  6. PCRE does support the \Q...\E escape for quoting substrings. Characters in
53  between are treated as literals. This is slightly different from Perl in that $  between are treated as literals. This is slightly different from Perl in that $
54  and @ are also handled as literals inside the quotes. In Perl, they cause  and @ are also handled as literals inside the quotes. In Perl, they cause
55  variable interpolation (but of course PCRE does not have variables). Note the  variable interpolation (but of course PCRE does not have variables). Note the
# Line 61  following examples: Line 69  following examples:
69  </PRE>  </PRE>
70  </P>  </P>
71  <P>  <P>
72  In PCRE, the \Q...\E mechanism is not recognized inside a character class.  The \Q...\E sequence is recognized both inside and outside character classes.
73  </P>  </P>
74  <P>  <P>
75  8. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})  7. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})
76  constructions. However, there is some experimental support for recursive  constructions. However, there is some experimental support for recursive
77  patterns using the non-Perl items (?R), (?number) and (?P&#62;name). Also, the PCRE  patterns using the non-Perl items (?R), (?number) and (?P&#62;name). Also, the PCRE
78  "callout" feature allows an external function to be called during pattern  "callout" feature allows an external function to be called during pattern
79  matching.  matching.
80  </P>  </P>
81  <P>  <P>
82  9. There are some differences that are concerned with the settings of captured  8. There are some differences that are concerned with the settings of captured
83  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
84  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".
85  </P>  </P>
86  <P>  <P>
87  10. PCRE provides some extensions to the Perl regular expression facilities:  9. PCRE provides some extensions to the Perl regular expression facilities:
88  </P>  </P>
89  <P>  <P>
90  (a) Although lookbehind assertions must match fixed length strings, each  (a) Although lookbehind assertions must match fixed length strings, each
# Line 123  package. Line 131  package.
131  (k) The callout facility is PCRE-specific.  (k) The callout facility is PCRE-specific.
132  </P>  </P>
133  <P>  <P>
134  Last updated: 03 February 2003  Last updated: 09 December 2003
135  <br>  <br>
136  Copyright &copy; 1997-2003 University of Cambridge.  Copyright &copy; 1997-2003 University of Cambridge.

Legend:
Removed from v.72  
changed lines
  Added in v.73

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12