Home  >  Article  >  Backend Development  >  php正则组平衡有关问题

php正则组平衡有关问题

WBOY
WBOYOriginal
2016-06-13 13:44:50931browse

php正则组平衡问题
Compilation failed: syntax error in subpattern name (missing terminator) at offset 46

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->$str = "<div class="a">
<div>cc</div>a<span>ab</span>c<div class="b">xxxy</div>
</div>";
preg_match_all("#((?'open'<div>]*>)((?:.(?!?div))*.)*?)((?'-open'</div>[^>]*>)((?:.(?!?div))*.)*?)#is",$str,$matches); 
print_r($matches);
 

请教一下,是不是PHP 不支持组平衡啊

------解决方案--------------------
"#((?'open'
]*>)((?:.(?!?div))*.)*?)((?:'-open'
[^>]*>)((?:.(?!?div))*.)*?)#is",
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn