I need to extract all images from an HTML, not just from <img>
tags but from anywhere, including relative paths. I tried this regex:
([a-z\-_0-9\/\:\.]*\.(jpg|jpeg|png|gif))
.. but it fails on encountering special chars. Like in this case for example.
How do I grab the path so that it starts from either '
(single quote), "
(double quote) or /
, no spaces in between and ends with image extension jpg|jpeg|png|gif
?
Edit: I use DOM parser where possible, but I must use regex here to extract paths from just about everywhere, including inline CSS and JS.