title: How to write this regex code snippet right?
body: <p>I am trying to get a UIWebView to display some text with images.
  The text has some links inside of it so for example:  </p>
  
  <blockquote>
    <p>"I once had a fish <strong><code>http://mysite.com/images/fish.jpg</code></strong>.
    I also owned a little dog and a rooster <strong><code>http://mysite.com/images/dog.jpg</code></strong>"</p>
  </blockquote>
  
  <p>would result in:</p>
  
  <blockquote>
    <p><strong>I once had a fish</strong></p>
  </blockquote>
  
  <pre><code>----------------------------------
  |                                 |
  |Fish Image From                  |
  |http://mysite.com/images/fish.jpg|
  |                                 |
  |                                 |
  ----------------------------------
  </code></pre>
  
  <blockquote>
    <p><strong>I also owned a little dog and a rooster</strong></p>
  </blockquote>
  
  <pre><code>----------------------------------
  |                                |
  |dog Image From                  |
  |http://mysite.com/images/dog.jpg|
  |                                |
  |                                |
  ----------------------------------
  --------------------------------------
  |                                    |
  |rooster Image From                  |
  |http://mysite.com/images/rooster.jpg|
  |                                    |
  |                                    |
  --------------------------------------
  
  
  
      NSMutableString *mutableString = [[NSMutableString alloc] initWithFormat:@"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;%@&lt;/body&gt;",string];
  
      NSString *pattern = @"http://.+\\.(?:jpg|jpeg|png|gif|bmp)";
      NSString *replacement = @"&lt;br /&gt;&lt;img style=\"width:100%;height:auto;\" src=\"$1\"/&gt;&lt;br /&gt;";
      NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern           
                            options:0 error:NULL];
      [regex replaceMatchesInString:mutableString
                            options:0
                            range:NSMakeRange(0, mutableString.length)
                            withTemplate:replacement];
  </code></pre>
  
  <p>But when I check on the result the image gets this: <code>&lt;br /&gt;&lt;img style="width:100%;height:auto;" src=""/&gt;&lt;br /&gt;</code> and the link is gone.</p>
  
  <p>Where the image has to be :</p>
  
  <p><strong>Text...</strong><br>
  <code>&lt;br /&gt;&lt;img style="width:100%;height:auto;" src="http://mysite.com/images/fish.jpg"/&gt;&lt;br /&gt;</code>  </p>
  
  <p><strong>Text...</strong>  </p>
  
  <p><code>&lt;br /&gt;&lt;img style="width:100%;height:auto;" src="http://mysite.com/images/dog.jpg"/&gt;&lt;br /&gt;</code>  </p>
  
  <p><code>&lt;br /&gt;&lt;img style="width:100%;height:auto;" src="http://mysite.com/images/rooster.jpg"/&gt;&lt;br /&gt;</code></p>