note 23888 added to ref.pcre
| From: | kingn at oclc dot org | Date: | Wed, 31 Jul 2002 03:18:18 +0000 |
| Subject: | note 23888 added to ref.pcre | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-34029@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/ref.pcre.php
http://master.php.net/manage/user-notes.php?action=edit+23888
http://master.php.net/manage/user-notes.php?action=delete+23888
http://master.php.net/manage/user-notes.php?action=reject+23888