--- code/trunk/doc/html/pcrecompat.html 2007/02/24 21:40:03 63 +++ code/trunk/doc/html/pcrecompat.html 2007/02/24 21:40:30 73 @@ -16,32 +16,40 @@ 5.8.

-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 +given in the +section on UTF-8 support +in the main +pcre +page. +

+

+2. PCRE does not allow repeat quantifiers on lookahead assertions. Perl permits them, but they do not mean what you might think. For example, (?!a){3} does not assert that the next three characters are not "a". It just asserts that the next character is not "a" three times.

-2. Capturing subpatterns that occur inside negative lookahead assertions are +3. Capturing subpatterns that occur inside negative lookahead assertions are counted, but their entries in the offsets vector are never set. Perl sets its numerical variables from any such patterns that are matched before the assertion fails to match something (thereby succeeding), but only if the negative lookahead assertion contains just one branch.

-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 not allowed in a pattern string because it is passed as a normal C string, terminated by zero. The escape sequence "\0" can be used in the pattern to represent a binary zero.

-4. The following Perl escape sequences are not supported: \l, \u, \L, +5. The following Perl escape sequences are not supported: \l, \u, \L, \U, \P, \p, \N, and \X. In fact these are implemented by Perl's general string-handling and are not part of its pattern matching engine. If any of these are encountered by PCRE, an error is generated.

-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 between are treated as literals. This is slightly different from Perl in that $ and @ are also handled as literals inside the quotes. In Perl, they cause variable interpolation (but of course PCRE does not have variables). Note the @@ -61,22 +69,22 @@

-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.

-8. Fairly obviously, PCRE does not support the (?{code}) and (?p{code}) +7. Fairly obviously, PCRE does not support the (?{code}) and (?p{code}) constructions. However, there is some experimental support for recursive patterns using the non-Perl items (?R), (?number) and (?P>name). Also, the PCRE "callout" feature allows an external function to be called during pattern matching.

-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 strings when part of a pattern is repeated. For example, matching "aba" against the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE it is set to "b".

-10. PCRE provides some extensions to the Perl regular expression facilities: +9. PCRE provides some extensions to the Perl regular expression facilities:

(a) Although lookbehind assertions must match fixed length strings, each @@ -123,6 +131,6 @@ (k) The callout facility is PCRE-specific.

-Last updated: 03 February 2003 +Last updated: 09 December 2003
Copyright © 1997-2003 University of Cambridge.