I am trying to make a so called text cleaner so that I could get rid of a few html elements without using the strip_tags()
function.
My regex looks like this: <em>|</em>|<p[^>]*>|</p[^>]*>|<span[^>]*>|</span[^>]*>|<div[^>]*>|</div[^>]*>| |<table[^>]*>(.*?)</table[^>]*>
My code looks like this:
$string = "some very messy string here ";
$pattern = '<em>|</em>|<p[^>]*>|</p[^>]*>|<span[^>]*>|</span[^>]*>|<div[^>]*>|</div[^>]*>| |<table[^>]*>(.*?)</table[^>]*>';
$replace = ' ';
$clean = preg_replace($pattern, $replace, $string);
echo $clean;
For reasons that are beyond my understanding the echo returns nothing.
Thank you for your time
UPDATE #1
If you are asking if I want to get rid of the tables with all the content inside them the answer is yes.