From c671f559eb842ae5d8844888e361110043ef4b74 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 13 Jun 2005 16:26:27 +0000 Subject: [PATCH] Document PCRE 4.3 # However, PCRE 5.0 is in the sources now git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@188306 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pcre/pattern.syntax.xml | 34 +++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/reference/pcre/pattern.syntax.xml b/reference/pcre/pattern.syntax.xml index 3d638768fd..35c2cc2196 100644 --- a/reference/pcre/pattern.syntax.xml +++ b/reference/pcre/pattern.syntax.xml @@ -1,5 +1,5 @@ - + @@ -67,7 +67,7 @@ The following Perl escape sequences are not supported: - \l, \u, \L, \U, \E, \Q. In fact these are implemented by + \l, \u, \L, \U. In fact these are implemented by Perl's general string-handling and are not part of its pattern matching engine. @@ -575,6 +575,15 @@ newline that is the last character of the string as well as at the end of the string, whereas \z matches only at the end. + + + \Q and \E can be used to ignore + regexp metacharacters in the pattern. For example: + \w+\Q.$.\E$ will match one or more word characters, + followed by literals .$. and anchored at the end of + the string. + + @@ -924,6 +933,13 @@ setting in one branch does affect subsequent branches, so the above patterns match "SUNDAY" as well as "Saturday". + + + It is possible to name the subpattern with + (?P<name>pattern). Array with matches will + contain the match indexed by the string alongside the match indexed by + a number, then. + @@ -1057,6 +1073,13 @@ them with a question mark. In other words, it inverts the default behaviour. + + Quantifiers followed by + are "possessive". They eat + as many characters as possible and don't return to match the rest of the + pattern. Thus .*abc matches "aabc" but + .*+abc doesn't because .*+ eats the + whole string. Possessive quantifiers can be used to speed up processing. + When a parenthesized subpattern is quantified with a minimum repeat count that is greater than 1 or with a limited maximum, @@ -1556,6 +1579,13 @@ there is no way to give an out-of-memory error from within a recursion. + + + (?1), (?2) and so on can be used + for recursive subpatterns too. It is also possible to use named + subpatterns: (?P>foo). + +