Home >Backend Development >PHP Tutorial >PHP正则-多个span标签有关问题

PHP正则-多个span标签有关问题

WBOY
WBOYOriginal
2016-06-13 10:03:561516browse

PHP正则-多个span标签问题

This is fake headline
如何提取标签,让上面的代码变成
[color="color: #ff0000;"][font-size="medium;"]This is fake headline[/font-size][/color]

这两标签相互颠倒的时候,问题就来了,因为他们的结束标签都是一样的,让人抓狂,有什么解决方法么。


------解决方案--------------------
使用preg的贪婪模式
------解决方案--------------------

$str = ' This is fake headline ';

preg_match_all('/

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