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