I know this question is around SO, but I can't find the right one and I still suck in Regex :/
I have an string and that string is valid HTML. Now I want to find all the tags with an certain name and attribute.
I tried this regex (i.e. div with type): /(<div type="my_special_type" src="(.*?)<\/div>)/.
Example string:
<div>Do not match me</div>
<div type="special_type" src="bla"> match me</div>
<a>not me</a>
<div src="blaw" type="special_type" > match me too</div>
If I use preg_match then I only get <div type="special_type" src="bla"> match me</div> what is logical because the other one has the attributes in a different order.
What regex do I need to get the following array when using preg_match on the example string?:
array(0 => '<div type="special_type" src="bla"> match me</div>',
1 => '<div src="blaw" type="special_type" > match me too</div>')
preg_*for HTML