http://qs321.pair.com?node_id=652992


in reply to Simplify HTML programatically

Many people here advocate a strategy that is void in the original question, ie to decide what tags to remove. The original question wanted a techique to remove ALL tags with some exceptions. I found this page while looking for a way to accomplish exactly the same thing.

Ive read many warnings against parsing html with regular expressions but for this task, are they still valid?

My predicament is that im changing wysiwyg editor on an old cms system to fck. However, for some of the messy old meterial i need to clean everything except some tags (the old editor used a strategy of "hugging the text" so there is ALOT of unknown stuff on hundereds and hundereds of pages).

Problem is, my brain is too small to formulate the regular expression needed.

/nic_tester