From d28c33adb9504af17d2665059d56ab373165bf5c Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Tue, 29 Jul 2014 12:46:16 +0000 Subject: [PATCH] Clarify some details of using bracket-style delimiters in regular expression patterns Patch suggested by Brandon Kelly (brandon@pixelandtonic.com) git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@334410 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pcre/pattern.syntax.xml | 35 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/reference/pcre/pattern.syntax.xml b/reference/pcre/pattern.syntax.xml index 7bd5c28fdd..80a7cb8bcb 100644 --- a/reference/pcre/pattern.syntax.xml +++ b/reference/pcre/pattern.syntax.xml @@ -44,20 +44,7 @@ #^[^0-9]$# +php+ %[a-zA-Z0-9_-]% -]]> - - - - - In addition to the aforementioned delimiters, it is also possible to use - bracket style delimiters where the opening and closing brackets are the - starting and ending delimiter, respectively. - - - +{\w[\w0-9]*} ]]> @@ -79,6 +66,26 @@ for injection into a pattern and its optional second parameter may be used to specify the delimiter to be escaped. + + In addition to the aforementioned delimiters, it is also possible to use + bracket style delimiters where the opening and closing brackets are the + starting and ending delimiter, respectively. (), + {}, [] and <> + are all valid bracket style delimiter pairs. + + + +]]> + + + Bracket style delimiters do not need to be escaped when they are used as meta + characters within the pattern, but as with other delimiters they must be + escaped when they are used as literal characters. + You may add pattern modifiers after the ending delimiter. The following is an example