I'm messing around with CSS files, and I'm trying to traverse through a CSS file using PHP. What I'm looking for is capturing any image path within a url() selector, using regex (any faster ways you know?).
So far I was able to find this expression: url(([^)]+))
but that one isn't 100% what I'm looking for. I need an expression that finds the url selector
and captures anything inside it, meaning if the code includes quotes or single quotes, they will not be captured. e.g: url("images/sunflower.png") the captured string should only be: images/sunflower.png
Appreciate the help.
'single'
or"double"
quotation marks and the URL itself may or may not contain matching or not-matching parentheses. However, if the CSS file is of your own creation and you know its makeup, then that is a different story. – ridgerunner Jun 15 '13 at 13:21