title: replacing <img> by <img></img> in a string
body: <p>I want to replace every <code>&lt;img&gt;</code> tag with closing <code>&lt;img&gt;&lt;/img&gt;</code> tags in a string. The string is actually an html document where the img tag are generated by me and always look like this :</p>
  
  <pre><code>&lt;img src="some_source.jpg" style="some style attributes and values"&gt;
  </code></pre>
  
  <p>Src is user input so it can be anything.
  I made a regex expression, not sure if correct because it's my first time using it but upon testing it was working. The problem is that I don't know how to keep the content of the <code>src</code>.</p>
  
  <pre><code>/&lt;img\ssrc=".+?"\sstyle=".+?"&gt;/g
  </code></pre>
  
  <p>But I have difficulties replacing the tags in the string.</p>
  
  <p>and all I got is this:</p>
  
  <pre><code>    Pattern p = Pattern.compile("/&lt;img\\ssrc=\".+?\"\\sstyle=\".+?\"&gt;/g");
      Matcher m = p.matcher(str);
      List&lt;String&gt; imgStrArr = new ArrayList&lt;String&gt;();
      while (m.find()) {
          imgStrArr.add(m.group(0));
      }
      Matcher m2 = p.matcher(str);
  </code></pre>