Jay wrote:
Why can´t i get this code to work:
$html = $_POST["htmlIn"];

$patterns[0] = "/<strike>/";
$patterns[1] = "/</strike>/";
$patterns[2] = "/align=\"left\"/";

$replacements[0] = "<del>";
$replacements[1] = "</del>";
$replacements[2] = " style=\"text-align:left;\"";

$xhtml = preg_replace($patterns, $replacements, $html);

Why are you using regular expressions? You're not replacing a pattern, you're replacing a constant. Use str_replace().


$xhtml = str_replace(array('<strike>','</strike>','align="left"'),array('<del>','</del>','style="text-align:left"'),$html);

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to