php regular equipped with div block
$a='<divid="css">1<div>2</div>3</div><div>4</div>';preg_match_all('/
php regular equipped with div block
$a='1234';
preg_match_all('/(.*?)<\/div>/',$a,$match);
echo '
';
var_dump ($ match);
I would like to ask experts: all matching divs written on the Internet are written like this, but when I wrote, I found that he could not completely match a div block! Such as this, my div id = css, his end / div is behind 3, but this can only be written to 2, and it ends. Is there any way to match his own div block?
------solution--------------------
http://downloads.sourceforge.net/project/simplehtmldom/simplehtmldom/1.5/simplehtmldom_1_5.zip?r=http://sourceforge.net/projects/simplehtmldom/files/&ts=1332749181&use_mirror=nchc
simplehtmldom class
Simple, practical and efficient
No need to fiddle with the rules at all
------solution--------------------
Nested tags are matched recursively
PHP code
(([^ <>] * | (? R)) *)] *> # ';
preg_match_all ($ pattern, $ str, $ matches);
echo $ matches [0] [0];
// 123
------solution--------------------
Explore
Um, what's the solution? If it's a page of code, we want to remove the head and tail divs. Is there any good solution?