I have a string in this form:
url(\"http://www.example.com/imgs/backgrounds/bg80.jpg\") repeat scroll 10% 0% transparent
This is from a CSS sty
A background url can have ' or " or none around the url inside the parenthesis
Valid urls
url("http://www.example.com/imgs/backgrounds/bg80.jpg")url('http://www.example.com/imgs/backgrounds/bg80.jpg')url(http://www.example.com/imgs/backgrounds/bg80.jpg)So for a generic solution you could use
var background = 'url("http://www.example.com/imgs/backgrounds/bg80.jpg") repeat scroll 10% 0% transparent',
reg = /(?:\(['"]?)(.*?)(?:['"]?\))/,
extracterUrl = reg.exec(background)[1];