JSFiddle - React, Tailwind, and code Playground
by Pasit R
HTML
<div class="product_wrapper">
<img alt="" src="http://services.google.com/fh/files/emails/screens.png#_here\_it_is" />
</div>
<pre id="the_result">result here.</pre>
JavaScript
function matchesImageSrc(){
var productSrc = $(".product_wrapper img").attr('src');
if(productSrc){
var matches = productSrc.match(/([^]+)\\_/);
if(matches){
return matches[1].split('_');
}
}
return "not found";
}
$('#the_result').text(matchesImageSrc());