php - split between 2 pattern in html tag -
this question has answer here:
- how parse , process html/xml in php? 27 answers
i have html tag this
<img src="ngakak.gif" title="ngakak" />
and want split tag 2 pattern, title=
, />
. result array this:
array ( [0] => <img src="ngakak.gif" [1] => "ngakak" )
i want splitting of 2 patterns worked direct in 1 regex. how preg_split ?
are looking extract title element img tags?
preg_match_all('/< *[img][^>]*title *= *["']{0,1}([^"'>]*)/',$content,$matches);