removing a tag
Hey Ray
If I wanted to remove the styling soemthing like this: <strong style="line-height: 25.6px;"></strong>
how would I modify
<?php
function convertString($string) {
$retStr = $string;
$retStr = str_replace(array("<br />","<br>","<p>","</p>","<h1>","</h1>","<h2>","</h2>","<blockquote>","</blockquote>","<strong>","</strong>","<em>","</em>","<u>","</u>"," "), "", $retStr);
$retStr = preg_replace("/\<a(.*)\>(.*)\<\/a\>/iU", "$2", $retStr);
$retStr = preg_replace("/\<span(.*)\>(.*)\<\/span\>/iU", "$2", $retStr);
$retStr = preg_replace("/\<u(.*)\>(.*)\<\/u\>/iU", "$2", $retStr);
$retStr = preg_replace("/\<h1(.*)\>(.*)\<\/h1\>/iU", "$2", $retStr);
$retStr = preg_replace("/\<strong(.*)\>(.*)\<\/strong\>/iU", "$2", $retStr);
$retStr = preg_replace("/<img[^>]+\>/i", " ", $retStr);
$retStr = preg_replace("/<h1[^>]+\>/i", " ", $retStr);
$retStr = preg_replace("/<h2[^>]+\>/i", " ", $retStr);
$retStr = preg_replace("/<h3[^>]+\>/i", " ", $retStr);
$retStr = preg_replace("/<p[^>]+\>/i", " ", $retStr);
return $retStr;
}
?>
As you can see I have $retStr = preg_replace("/\<strong(.*)\>(.*)\<\/strong\>/iU", "$2", $retStr); but it isnt removing the the tag
cheers
Jamie