Regex for retrieving the parameter of the css url function...
Posted
by Kieron
on Stack Overflow
See other posts from Stack Overflow
or by Kieron
Published on 2010-06-07T22:50:37Z
Indexed on
2010/06/07
23:02 UTC
Read the original article
Hit count: 387
Hi,
I'm trying to get the url portion of the following string:
url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)
So the required part if images/ui-bg_highlight-soft_75_cccccc_1x100.png
.
Currently I've got this:
url\((?<url>.*)\)
But it seems to be choking on the following example:
url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30)
Which results in images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30
...
I'd like to make sure that it supports as many variations as possible (additional whitespace etc).
Thanks!
Kieron
© Stack Overflow or respective owner