title: Using python regular expression to find an image path
body: <p>I have a variable like the one below:</p>
  
  <pre><code>var = '&lt;img src="path_1"&gt;&lt;p&gt;Words&lt;/p&gt;&lt;img src="path_2&gt;'
  </code></pre>
  
  <p>Its a string, but inside is obviously html elements. How do I get the first path only (i.e. path_1) using a regex?</p>
  
  <p>I am trying something like this:</p>
  
  <pre><code>match = re.match(r'src=\"[\w-]+\"', var)
  print match.group(0)
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  AttributeError: 'NoneType' object has no attribute 'group'
  </code></pre>
  
  <p>Any help is appreciated.</p>