note 21008 added to function.preg-match-all
| From: | mow@php.net | Date: | Thu, 25 Apr 2002 08:24:20 +0000 |
| Subject: | note 21008 added to function.preg-match-all | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29824@lists.php.net to get a copy of this message | ||
i've worked hard to get this shit working.. i wanna have a script wich replaces everything with
its htmlchars but not html-tags itself.
<?php
$text = "I am HTML ööö with tags such as <a href=\"http://www.google.de\">möw</a>
in it <b>öö</b> mow";
preg_match_all( '/(.*?)(\<.+?\>)(.*?)/', $text, $text2 );
for($i=0;$i<count($text2[1]);$i++) {
$text=str_replace($text2[1][$i],htmlentities($text2[1][$i]),$text);
}
echo $text;
?>
--
http://www.php.net/manual/en/function.preg-match-all.php
http://master.php.net/manage/user-notes.php?action=edit+21008
http://master.php.net/manage/user-notes.php?action=delete+21008
http://master.php.net/manage/user-notes.php?action=reject+21008