From e6bb3e8635854e7015ae2099f051843f073725f4 Mon Sep 17 00:00:00 2001 From: Daniel Egeberg Date: Sat, 19 Dec 2009 21:10:22 +0000 Subject: [PATCH] Closes #50232. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@292344 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pcre/pattern.syntax.xml | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/reference/pcre/pattern.syntax.xml b/reference/pcre/pattern.syntax.xml index 65cd412631..74d980d48a 100644 --- a/reference/pcre/pattern.syntax.xml +++ b/reference/pcre/pattern.syntax.xml @@ -26,6 +26,62 @@ itself. +
+ Delimiters + + When using the PCRE functions, it is required that the pattern is enclosed + in delimiters. A delimiter can be any non-alphanumeric, + non-whitespace character. + + + Often used delimiters are forward slashes (/), hash + signs (#) and tildes (~). The + following are all examples of valid delimited patterns. + + + /foo bar/ + #^[^0-9]$# + +php+ + %[a-zA-Z0-9_-]% + + + + + If the delimiter needs to be matched inside the pattern it will have to be + escaped using a backslash. If the delimiter appears often inside the + pattern, it is a good idea choosing another delimiter to increase + readability. + + + /http:\/\// + #http://# + + + The preg_quote may be used to inject a string into + a pattern and its second parameter allows to specify the chosen delimiter + so it will be escaped as well. + + + In addition to the aforementioned delimiters, it is also possible using + bracket style delimiters where the opening and closing brackets are the + starting and ending delimiter, respectively. + + + {this is a pattern} + + + + + You may add pattern + modifiers after the ending delimiter. The following is an example + of case-insensitive matching: + + + #[a-z]#i + + + +
Meta-characters