javascript - Regex for background image -


i've made regular expression getting background image patterns:

pattern p = pattern.compile("background(-image)?:[\\s]?url[\\s]*\([\\s]*(?<url>[^\)]*)[\\s]*\)[\\‌​s]*"); 

but failed in case, because of #66cc33:

background:#66cc33 url(images/bg-topbar.png) 

can me modify pattern?

you can use regex, doesn't care url() content:

background(-image)?:.*?url\(\s*(?<url>.*?)\s*\) 

Comments