I was experimenting with str_replace but I'm having some problems with this specific line:
$content = str_replace('<div id='demo'><a href='https://www.example.com' target='_blank'><img alt='Demo' src='//example.com/image.png' /></a></div>', '', $content);
I've tried changing the quotes but nothing worked. Thank you for your time.
EDIT: I got it to work by separing the code into two different str_replace.