note 72523 added to reference.pcre.pattern.syntax
| From: | rn214 at cam dot ac dot uk | Date: | Tue, 23 Jan 2007 03:17:49 +0000 |
| Subject: | note 72523 added to reference.pcre.pattern.syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122053@lists.php.net to get a copy of this message | ||
It isn't actually documented here, but patterns can begin with almost anything - you can choose
the delimiter to suit. Normally, a pattern has the format: /rrr/ooo where the / denotes the
beginning and ending of the regex" rrr", and "ooo" are some pattern modifiers.
However, as with perl, you can use any character in place of the slash. For example, @rrr@ooo is
perfectly valid. The chosen character is autodetected.
The advantage of doing this is when / is a common character in your regex, and you don't want
to keep escaping it with \/ .
For example, a regex to match "http://" would normally be:
/http:\/\// , but it's easier to read as: @http://@
----
Server IP: 83.138.144.80
Probable Submitter: 81.187.40.226 (proxied: 192.168.0.113)
----
Manual Page -- http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
Edit -- https://master.php.net/note/edit/72523
Del: integrated -- https://master.php.net/note/delete/72523/integrated
Del: useless -- https://master.php.net/note/delete/72523/useless
Del: bad code -- https://master.php.net/note/delete/72523/bad+code
Del: spam -- https://master.php.net/note/delete/72523/spam
Del: non-english -- https://master.php.net/note/delete/72523/non-english
Del: in docs -- https://master.php.net/note/delete/72523/in+docs
Del: other reasons-- https://master.php.net/note/delete/72523
Reject -- https://master.php.net/note/reject/72523
Search -- https://master.php.net/manage/user-notes.php