在线工具 在线编程 在线白板 在线工具 在线编程 在线白板

求看一段正则表达式,它在windows上的php上表现正常,可是在linux上就不可以。

匹配一段合法的html标签,类似<img src="
http://img.baidu.com/hi/jx2/j_0002.gif
">
所有字母必须小写,用一个空格隔开各个属性,属性值必须用英文双引号括起。
</?[a-z]+( [a-z]+="[^"<>]*")*>
在线等。。。急。。
最新回答
薄荷心凉

2025-02-25 07:52:38

[root@temp /tmp/baiduzhidao]#cat re.html 
bdc
<img src="
https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/hi/jx2/j_0002.gif">

abc
work
hello

[root@temp /tmp/baiduzhidao]#grep -E '</?[a-z]+( [a-z]+="[^"<>]*")*>'  re.html 
<img src="
https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/hi/jx2/j_0002.gif">

试试看?