PDA

View Full Version : striping HTML


ACJavascript
03-06-2004, 05:44 PM
Hello All,

Okay, How Do I strip html characters?

For example: <b>

I want to remove the two <> and just have the b.


Anybody know a good way to do that?? :D

missing-score
03-06-2004, 06:08 PM
try:

<?php

$string = "String with some <strong>HTML</strong> characters <u>to</u> replace";

$str = preg_replace("/\\<(\\s{0})\\>/is", " $1 ", $string);

echo $str;

/* Would output:
String with some strong HTML /strong characters u to /u replace
*/

?>

Is that what you want?

ACJavascript
03-06-2004, 06:13 PM
PERFECTO!!! :D


THANKS!

missing-score
03-06-2004, 06:15 PM
no problem :)