title: Writing a REGEX to match the src, height and width attributes of an img tag
body: <p>I'm trying to write a regex expression to match the src, width and height attributes on an image tag. The width and height are optional.</p>
  
  <p>I have came up with the following:</p>
  
  <pre><code>(?:&lt;img.*)(?&lt;=src=")(?&lt;src&gt;([\w\s://?=&amp;.]*)?)?(?:.*)(?&lt;height&gt;(?&lt;=height=")\d*)?(?:.*)(?&lt;width&gt;(?&lt;=width=")(\d*)?)?
  </code></pre>
  
  <p>expresso shows this matching only the src bit for the following html snippet</p>
  
  <pre><code>&lt;img src="myimage.jpg" height="20" /&gt;
  &lt;img src="anotherImage.gif" width="30"/&gt;
  </code></pre>
  
  <p>I'm hoping I'm really close and someone here can point out what I'm doing wrong, I have a feeling its my optional in between characters bit (?:.*) i've tried making it non greedy to no success. So any pointers?</p>