JSFiddle - React, Tailwind, and code Playground

by Manpreet Singh

HTML

<p><a href="https://www.theprodigybaby.com/products/weekend-prodigy-framework-india/categories/2147844232/posts/2148760860?wvideo=cymdlhqiao"><img src="https://kajabi-storefronts-production.kajabi-cdn.com/kajabi-storefronts-production//site/123457/products/TO3Hc0wmSSWwUPi27P3z_63f3e09fcb9722131253ed85e31c4e9c.jpg" width="400" height="225" style="width: 400px; height: 225px;"></a></p><p><a href="https://www.theprodigybaby.com/products/weekend-prodigy-framework-india/categories/2147844232/posts/2148760860?wvideo=cymdlhqiao">Raising Superstars | Prodigy Baby | As Seen On Shark Tank</a></p>


<p><a href="https://www.theprodigybaby.com/products/weekend-prodigy-framework-india/categories/2147844232/posts/2148760861?wvideo=2qby3d4oyu"><img src="https://kajabi-storefronts-production.kajabi-cdn.com/kajabi-storefronts-production//site/123457/products/1aWiHW8xTRynxeFiUYvn_5d104b87e4595a80a7eeffadac199ade.jpg" width="400" height="225" style="width: 400px; height: 225px;"></a></p><p><a href="https://www.theprodigybaby.com/products/weekend-prodigy-framework-india/categories/2147844232/posts/2148760861?wvideo=2qby3d4oyu">Raising Superstars | Prodigy Baby | As Seen On Shark Tank</a></p>

JavaScript

var m,
    urls = [], 
     htmlString = 'This is a sample HTML string<br /><p><img src="/s3:/design_practices/0_1/15193623229161302354/eagle_PNG1227.png" width="323" height="259"  />  &nbsp;</p><br /><p><img src="/s3:/design_practices/image-url-1.png" alt=""  width="323" height="259" /></p>';

    rex =  /<img.*?src="(.*?)"[^>]+>/g;
    var result = htmlString.match(rex);
    console.log(result)
    

while ( m = rex.exec( htmlString ) ) {
    urls.push( m[1] );
    console.log(m)

}
console.log("m");
console.log(m)

console.log(urls)