I need to remove a particular string using php, the string needs to start with <div class='event'>
followed by any possible string but which contains $myVariable
, which is then followed by </div>
. How do I remove all this using preg_replace()
? I have worked out it might be something like this
preg_replace("<div class='event'>(.*)" . $myVariable . "(.*)</div>", "", $content);
But I cant get it to work.
Update:
I need to remove a div
and everything inside it, the div contains an event name and date but I can only delete the div based on the events name and so the date needs to be defined as practically any string.