javascript - Get value from url(..) if it does not contain Data URI — regex -
my question url(..)
in css.
i have string url('blah-blah.jpg')
. i've tried uri value , i've got correctly (in javascript) using regex:
/url\(\s*['"]?(.*?)['"]?\s*\)/g;
but if url
contains data uri don't want it. how should modify regex it? think should add negative lookahead section, can't correctly.
examples of mismatching:
url(data:image/gif;base64,r...) url("data:image/png;base64,ga..")
examples of matching:
url(http://stackoverflow.com/favicon.ico) url("http://wikipedia.org/jimmy.png")
note: want regex solution. know in js can use other tools problem, need regex. thanks!
this should trick:
url\(\s*['"]?(?!['"]?data:)(.*?)['"]?\s*\)
Comments
Post a Comment