Reputation: 3819
This Regex:
$pattern = '/url\(([^)]+)\)/';
matches everything between url( ... )
in CSS files. The problem: If there are quotes, like this: url('...')
, they occur in the returned phrase as well.
How to return a phrase without quotes, if there are any?
Upvotes: 0
Views: 74
Reputation: 67988
url\(['"]?([^)]+?)['"]?\)
This should do it for you.Make ' or "
optional.
See demo.
http://regex101.com/r/sU3fA2/27
Upvotes: 1