title: Regular expression to extract image url from html code
body: <p>I wanted to extract Url of image from html code, e.g. html code below:    </p>
  
  <pre><code>&lt;div class="imageContainer"&gt;
     &lt;img src="http://ecx.images-amazon.com/images/I/41%2B7N48F7JL._SL135_.jpg"
        alt="" width="135" height="94"
        style="margin-top: 21px; margin-bottom:20px;" /&gt;&lt;/div&gt;
  </code></pre>
  
  <p>And I got a code from net </p>
  
  <pre><code>String regexImage = "(?&lt;=&lt;img (*)src=\")[^\"]*";
  Pattern pImage = Pattern.compile(regexImage);
  Matcher mImage = pImage.matcher(elementString);
  while (mImage.find()) {
     String imagePath = mImage.group();}
  </code></pre>
  
  <p>which is working and has re(regular expression)  </p>
  
  <pre><code>"(?&lt;=&lt;img src=\")[^\"]*"
  </code></pre>
  
  <p>But now I want to extract image url from html code like below :</p>
  
  <pre><code>&lt;img onerror="img_onerror(this);" data-logit="true" data-pid="MOBDDDBRHVWQZHYY"
     data-imagesize="thumb"
     data-error-url="http://img1a.flixcart.com/mob/thumb/mobile.jpg"
     src="http://img8a.flixcart.com/image/mobile/h/y/y/samsung-galaxy-s-duos-s7562-125x125-imadddczzr4qhqnc.jpeg"
     alt="Samsung Galaxy S Duos S7562: Mobile"
     title="Samsung Galaxy S Duos S7562: Mobile"&gt;&lt;/img&gt;&lt;/a&gt;
  &lt;div class="bp-offer-image image-offer"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>where there is code between img and src=</p>
  
  <p>I'm trying the regular expression as <code>"(?&lt;=&lt;img (*)src=\")[^\"]*"</code>
  but its not working. So please give me regular expression so that i can extract image url i.e.  <code>http://ecx.images-amazon.com/images/I/61xqOQ3Sj8L._SL135_.jpg</code> from above html code.</p>
  
  <p>And, first I'm using Jsoup to parse html to extract tags containing img :</p>
  
  <pre><code>doc = Jsoup.connect(urlFromBrowse).get();
              Elements elements = doc.getElementsByTag("img");
  
              for (Element element : elements) {
                  String elementString = element.toString();
  </code></pre>
  
  <p>and passed this elementString to matcher() meathod. And from the tag(element) that I'm getting, I'm using regular expression to parse image url, name etc things.</p>