title: JavaScript get img src in string
body: <pre><code>data = "&lt;p&gt;&lt;img src="data:image/jpeg;base64,/9j//9k="&gt;Note: example&lt;/p&gt;&lt;p&gt;today&lt;/p&gt;"
  
  Expected result
  data:image/jpeg;base64,/9j//9k=
  
  Code
  var m, regex = (/&lt;p[^&gt;]+&lt;img[^&gt;]+src="data:image([^"&gt;]+)/g);
  m = regex.exec(data);
  
  console.log(data);//null
  </code></pre>
  
  <p>I'm trying to get the encoded base64 image src in a string using regex to display in my textarea but I always get the <code>null</code> result in the console log.</p>