note 92806 added to function.preg-match-all
| From: | MindFreakTheMon at osu1 dot php dot net | Date: | Mon, 10 Aug 2009 15:32:57 +0000 |
| Subject: | note 92806 added to function.preg-match-all | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159271@lists.php.net to get a copy of this message | ||
royaltm75 at NOSPAM dot gmail dot com, your function is realy useful,
but it fails when in text located more than two self-close elements in a sequence.
For expample:
<link rel="alternate" type="text/html" hreflang="en" href="http://example.org/" />
<link rel="self" type="application/atom+xml" href="http://example.org/feed.atom"/>
Just upgrade the pattern:
<?
'@\<\s*?(\w+)((?:\b(?:\'[^\']*\'|"[^"]*"|[^\>])*)?)
(?:\>((?:(?>[^\<]*)|(?R))*)\<\/\s*?\\1(?:\b[^\>]*)?
\>|\<\s*(\w+)(\b(?:\'[^\']*\'|"[^"]*"|[^\>])*)?\/?\>
|/\>)@uxis'
?>
And use ternary operator to check if $set[3] is set.
----
Server IP: 88.81.245.102 (proxied: 91.196.196.205 1.0 localhost.ua.elro.com:3128
(squid/2.5.STABLE14))
Probable Submitter: 77.123.137.61
----
Manual Page -- http://www.php.net/manual/en/function.preg-match-all.php
Edit -- https://master.php.net/note/edit/92806
Del: integrated -- https://master.php.net/note/delete/92806/integrated
Del: useless -- https://master.php.net/note/delete/92806/useless
Del: bad code -- https://master.php.net/note/delete/92806/bad+code
Del: spam -- https://master.php.net/note/delete/92806/spam
Del: non-english -- https://master.php.net/note/delete/92806/non-english
Del: in docs -- https://master.php.net/note/delete/92806/in+docs
Del: other reasons-- https://master.php.net/note/delete/92806
Reject -- https://master.php.net/note/reject/92806
Search -- https://master.php.net/manage/user-notes.php