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

php正则组平衡有关问题

WBOY
Release: 2016-06-13 13:44:50
Original
992 people have browsed it

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);
Copy after login
 

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

------解决方案--------------------
"#((?'open'
]*>)((?:.(?!?div))*.)*?)((?:'-open'
[^>]*>)((?:.(?!?div))*.)*?)#is",
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template