Jochem Maas wrote: ...
regular expressions, heres an example:
a slightly better example, which will display nicely if you
try the test in a browser (I think most people start out that way, I know I did.)
<?
if (isset($_SERVER['HTTP_HOST'])) { ob_start(); }
$input = 'this <div>is some</div> <u><b class="haxor">bad</b></u> HTML'; echo "{$input}\n"; $input = preg_replace('/<\/?[^pbiu\/][^>]*>/', '', $input); echo "{$input}\n"; $input = preg_replace('/<([pbiu])[^>]*>/', '<\1>', $input); echo "{$input}\n"; $input = str_replace('bad', 'good', $input); echo "{$input}\n";
if (isset($_SERVER['HTTP_HOST'])) { echo '<pre>'.htmlentities(ob_get_clean()).'</pre>'; }
?>
...
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php