I have a page where I am stripping the html tags down. Basically, it will allow certain tags, but still strips out ALL attributs of the tag, so it works something like this:
$allowed_tags = "<p><br><strong><b><i><u>"; // State which tags are allowed $info = strip_tags($info, $allowed_tags); // Strip all unwanted tags out $allowed_tags = "p|br|strong|b|i|u"; // Convert tags for regular expression $info = preg_replace("/<(?!".$allowed_tags.")[^>]*>/", '<\1>', $info); // Strip out all attributes from allowed tags This will strip all attributes out of those tags, so it will turn something like this <p some stuff here>My p tag</p> into this <p>My p tag</p>. The above regular expression will handle this just fine. The only problem I am running into is when someone uses a less than sign in their input (<). So when someone puts something like: 2 < 8 in their input it gets changed to this: 2 <>. How can I set it to only replace things when there is a < and a matching > for it? Anyone have any ideas? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php