I’m having a hard time trying to remove duplicated images from an specific text/article.
Let’s say that I have an image tag where the src=”http://domain.com/image.jpg” and
I want to remove(/hide) all the images that have the following pattern:
http://domain.com/image-999x999.jpg
Currently, my regex expression is (and it isn’t working):
'/'.preg_quote('src="http://domain.com/image-').'([0-9]{3}\x[0-9]{3})\.(gif|png|jpg)/i'
(the regex, as an example, should ignore this: http://domain.com/image-20-999×999.jpg)
Any suggestions are more then welcome!
Cheers,
In this case the
preg_quote()isn’t working, because you left out the second parameter. It needs to know your used delimiter, else it can’t escape it:Preferrably you could use another delimiter for the regex itself however. Like
#that isn’t present in your base href. And you don’t actually need the quoting if it’s just that fixed string.