simonmlewis wrote:preg_match doesn't do multiples from what I can see.
Regular expressions sure can do multiples. It's called "alternation".
Code: Select all
#</?(font|span|script|style|...)[^>]*>#i
But still, don't think this is the best way to do this.
- If you're afraid of people copying stuff from Word because of the stupid HTML it inserts, tell them not to copy stuff from Word.
- If you let them insert whatever they want, how will you know whether they didn't add the "stupid HTML" themselves intentionally?
- If you want to filter out some tags then you're 99% better off thinking of a list of valid tags and removing everything not in the list - not the opposite.
- If you want to remove certain tags then you'll have a hard time. You hear about what happened years ago with MySpace and <script> tags?