Reputation: 4715
I'm using a RegEx
to extract all background-images
from a css file.
I simply use a regexp as below:
/url\s?+\("?([^\)\"]+)?"?\)/
that matches something like url ("images/bg.jpg")
.
Now i want to ignore background images with absolute URL. So i thought to check if have started with http
or https
then ignore it.
But don't know how to edit RegEx
, I'm programming using PHP
Upvotes: 1
Views: 56
Reputation: 425418
Use a negative look-ahead (?!http)
to assert that the following chars are not "http":
/url\s*\("?(?!http)([^\)\"]+)?"?\)/
Upvotes: 2