<img src=image/ad1.gif width="128" height="36"/>
<img src='image/ad2.gif' width="128" height="36" />
<img src=\'image/ad3.gif\' width="128" height="36" />
<img src="image/ad4.gif" width="128" height="36" />
<img src=\"image/ad5.gif\" width="128" height="36" />
正则取上述代码内src的值
image/ad1.gif
image/ad2.gif
image/ad3.gif
image/ad4.gif
image/ad5.gif
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
获取src的值str,然后 str.match(/image(S*)gif/)[0]
我也不知道正不正确
这样得到的内容会包含单引号什么的,对于带有反斜线的单双引号先去掉反斜线,然后trim一下就行了,例如
大致这样,具体的自己调试吧。不太复杂的正则匹配优先考虑关键字符来排除结果,比如本例中的空格及制表符。
http://tool.oschina.net/regex/
此处应该有红包
你可以试试:在线正则表达式生成工具
我的好像直接就对了