JSFiddle - React, Tailwind, and code Playground
HTML
<div style="background: url('a.jpg')">test1</div>
<span style="margin:1em; background-image: url('b.jpg'); color:#234;">test2</span>
<div style="margin:1em; background:#eee; color:#234; list-style:url('notme.jpg')">test3</div>
Found:
<ul id="result"></ul>
JavaScript
var img_urls=[];
$('[style*="background"]').each(function() {
var style = $(this).attr('style');
var pattern = /background.*?url\('(.*?)'\)/g;
var match = pattern.exec(style);
if (match) {
img_urls.push(match[1]);
//just for testing, not needed:
console.log('<li>'+match[1]+'</li>');
}
//print the results
});