I know how to find an img tag within a string but I need to exclude any img tag with gif extension in it. How do I use the negative in my preg_match? I only need the first image tag which does not contain .gif extension.
I currently have this:
$text = html_entity_decode($text, ENT_QUOTES, 'UTF-8');
$pattern = "/<img[^>]+\>/i";
preg_match($pattern, $text, $matches);
$text = $matches[0];
$text will give me the first tag, for e.g. <img src="something.gif" border="0" />
However, I do not want to accept .gif, so if the first is a gif, it will skip it and continue searching for other .
Please advise me how to change my code to it.
Thanks a bunch!