November 12th, 2006, 02:02 AM
Regexp, not match
i wanted to remove all html tag except some basic tag like <b>,<p>,<font> etc.
therefore i want to to know how to do that, i tried something like
preg_replace('/<(!b)>.+<\/\1>/i', '**tag removed**', $tempText);
preg_replace('/<([^bp])>.+<\/\1>/i', '**tag removed**', $tempText); (this work only for single character tag like '<b>','<p>' but not '<em>'.
example '<script>content content</script>' will be changed to '**tag removed**'
so what i want to do is something like if the tag do not match the tag i allowed, it will remove it.