tags:

views:

62

answers:

1
</?(?i:script|div|table|frameset|b|frame|iframe|style)(.|\n)*?>

I'm trying to filter certain HTML elements using this regex expression. I also want to filter "b" and "/b" as well but it doesn't seem to work for those.

Thank you.

+1  A: 

I would recommend you to instead of removing some specific tags, to allow some specific tags, and remove all other. That is, have a default-forbid policy.

aioobe
Can you tell me what that allow would look like? TY for your reply.
Kevin
Well, instead of removing the tags that match, remove all other tags. Btw, is this question intended for a specific programming language? (I could probably help you further if it's Java.)
aioobe
`(.|\n)` matches everything, including newlines. `[.\n]` matches only periods and newlines. I think the first was intended.
Jander
oops.. fixed....
aioobe