I search for images in a forum post with this PHP code:
if(preg_match("~<img.*src=\"(.*)\".*/>~isU", $htmltext, $imatch))
{
$imageurl = $imatch[1];
}
This will find the first image in the htmltext.
However, I want to skip any images that are smilie icons. All the smilie icons rest in the folder /forum/smilies/.
How can I exclude this folder from the regular expression?
It is not recommended to use regex when you try to parse HTML. You can take a look at this answer on this same problem.
This will do the trick:
$validis an array containing all non-simileyimg‘ssrcwithin the given$htmltext.