i have a css file with a bunch of background image urls:
.alert-01 {
background: url(\'img/alert-01.jpg\') center no-repeat;
}
.alert-02 {
background: url(\'
Use the following regex:
/\burl\([^)]+\)/gi
There's no need to use anchors (^
and $
) as they would restrict the match over whole string input and hence fail. To capture the image path separately so that you can use it easily (and avoid substring) when constructing your tags use:
/\burl\('([^']+)'\)/gi
This captures img/alert-xx.jpg
in group one.