note 72523 deleted from reference.pcre.pattern.syntax by colder
| From: | colder@php.net | Date: | Mon, 18 Jun 2007 18:07:53 +0000 |
| Subject: | note 72523 deleted from reference.pcre.pattern.syntax by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127570@lists.php.net to get a copy of this message | ||
Note Submitter: rn214 at cam dot ac dot uk
----
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://@