in reply to Empty tags cleaner regex (for pre-validated XHTML)

So you want to remove empty paragraph elements that provide vertical formating and empty table cells and so on?

If your HTML is clean (passes through HTML::Lint without errors) you may be able to use XML::Twig for the processing. Alternatively HTML::TreeBuilder may give more milage than TokeParser if you are doing a lot of editing.


DWIM is Perl's answer to Gödel
  • Comment on Re: Empty tags cleaner regex (for pre-validated XHTML)

Replies are listed 'Best First'.
Re^2: Empty tags cleaner regex (for pre-validated XHTML)
by Your Mother (Archbishop) on Dec 13, 2005 at 18:39 UTC

    I've never really used TreeBuilder; once months ago for a test. Thanks for suggesting it. It might let me do everything at once. In this case, it's for user provided input; no tables will be allowed and typographically speaking, paragraph tags are an invalid way to achieve formatting. Should be CSS or at worst, <br />s.