I try to match all images that contain a specific class by using the preg_match_all
function.
This is my old code that match the all images in the content:
preg_match_all( '/<img[\s
]+.*?>/is', $content, $matches );
And this is the code that I try to made to match the images that only have a specific class but I failed:
preg_match_all( "/(<img((?!(.*?)class=['\"](.*?)comment-media(.*?)['\"](.*?)).)*>)+/is", $content, $matches );
The class that I need to search for it is: comment-media