regex - JavaScript regexp parsing an array of URLs -
string
url(image1.png), url('image2.png'), url("image3.png")
note '
, "
delimiters. nice handle them well, i'm happy if first form captured.
var results = 'image1.png', 'image2.png', 'image3.png';
i utilize regular expressions in javascript parse string used css property of element multiple backgrounds. aim url of images set in background of element using css.
see more: http://www.css3.info/preview/multiple-backgrounds/
jsfiddlehttp://jsfiddle.net/fcx9x59r/1/
/url\(([^"']+?)\)|'([^'"]+?)'\)|"([^'"]+?)"\)/g
try this.grab captures.see demo.
http://regex101.com/r/qq3kg7/1
javascript regex
No comments:
Post a Comment