任何工作正则表达式来查找图像的URL?通过使用正则表达式查找图像网址
例子:
var reg = /^url\(|url\(".*"\)|\)$/;
var string = 'url("http://domain.com/randompath/random4509324041123213.jpg")';
var string2 = 'url(http://domain.com/randompath/random4509324041123213.jpg)';
console.log(string.match(reg));
console.log(string2.match(reg));
我绑,但会失败,此reg
格局将是这样的,我只是想图像URL url(" ")
url()
我只是想获得输出像http://domain.com/randompath/random4509324041123213.jpg
http://jsbin.com/ahewaq/1/edit
你只是试图从字符串中提取网址? – 2013-03-14 14:21:55
我只想得到像'http:// domain.com/randompath/random4509324041123213.jpg'这样的输出@JamesHill – l2aelba 2013-03-14 14:22:18