【发布时间】:2018-03-03 06:22:34
【问题描述】:
我想使用正则表达式检索图像标签的类和src。
class 和 src 的位置可以在任何位置。
我可以从/<img[^>]* src="([^\"]+)"[^>]*>/i得到src
<img width="100" height="100" src="/woocom.png" class="hello hel" alt="woo">
<img width="100" height="100" class="hello hel" src="/woocom.png" alt="woo">`
【问题讨论】:
-
我还以为这是一个 Javascript 问题
-
你可以通过2个正则表达式得到它,一个接一个。有什么理由不这样做吗?