note 23888 deleted from ref.pcre by sniper
| From: | sniper@php.net | Date: | Tue, 30 Sep 2003 12:18:12 +0000 |
| Subject: | note 23888 deleted from ref.pcre by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57410@lists.php.net to get a copy of this message | ||
Note Submitter: kingn@oclc.org
----
Back References should be escaped: such as \\1 \\2
Example:
preg_match("/<(\w+)(.*?)>(.+)<\/\\1>/s", $data, $regs);
This attempts to parse XML/HTML like data... Where:
$regs[1] is the tag name
$regs[2] are any tag properties
$regs[3] is the data within the tag
This handles the base case for an algorithm that could parse an entire XML form recursively.