Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个这样的html标签
<img src="ngakak.gif" title="ngakak" />
我想用 2 种模式分割标签,它们是title=和/> 。然后将产生这样的数组:
title=
/>
Array ( [0] => <img src="ngakak.gif" [1] => "ngakak" )
我希望在一个正则表达式中直接拆分 2 种模式。如何用 preg_split 做到这一点?
您是否要从所有 img 标签中提取标题元素?
preg_match_all('/< *[img][^>]*title *= *["']{0,1}([^"'>]*)/',$content,$matches);