title: regex help - python - extract all image url from css
body: <p>I am trying to extract all the image (.jpg, .png, .gif) uri's from css files.</p>
  
  <p>Sample css</p>
  
  <pre><code>.blockpricecont{width:660px;height:75px;background:url('../images/postBack.jpg') 
  repeat-x;/*background:url('../images/tabdata.jpg') repeat-x;*/border: 1px solid #B7B7B7;
  </code></pre>
  
  <p>regex used - </p>
  
  <pre><code>  images = re.compile("(?:\()(?:'|\")?(.*\.jpg('?))", flags=re.IGNORECASE)
  </code></pre>
  
  <p>The problem is, there are few css classes with commented code in it (/* ---- */) and these comments contain .jpg reference. The output I am getting for the above regex is</p>
  
  <pre><code>output
   ["../images/postBack.jpg') repeat-x;/*background:url('../images/tabdata.jpg'"]
  
  expected output:
   ["../images/postBack.jpg"]
  </code></pre>
  
  <p>I want my regex to stop at the first match of .jpg but its continuing till the end of the line.</p>
  
  <p>Thanks in advance.</p>