Home  >  Article  >  Backend Development  >  正则匹配<p>标签

正则匹配<p>标签

WBOY
WBOYOriginal
2016-06-23 14:18:582416browse

正则:"/

/iU"
我想匹配到

test

这样的标签,但是不想匹配到这样的标签,请问如何修改?

回复讨论(解决方案)

正则:"/

/iU"
我想匹配到

test

这样的标签,但是不想匹配到这样的标签,请问如何修改?
对了不仅仅

test

能匹配到,

test

也要能匹配到。高手帮帮忙呀

$str ='

test1

test2

test3';
preg_match_all('@

(.*?)@isU',$str,$match);
var_dump($match);

都不知道你是要匹配

还是

test

$str = "

text

111

test

777

"; lz的意思是不是 类似于str这样的一个字符串 只匹配出

text

   和 

test

 这样的标签

"/

/iU"
就不会匹配到  这样的了

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