And as for CDATA sections, most people without an SGML background don't even know what they do, and don't have them in their HTML as a rule.

You mean people who put SCRIPT or STYLE elements in their HTML have an SGML background? Wow, SGML is far more popular than I thought.

Plus in absence of evidence to the contrary, the person is in control of the HTML and has a pretty good idea of what's in there.

He may, but we don't. He didn't tell us what's in the HTML file. It's easy to just assume things, but I can play that game as well. Just assume there's no <u> present and do nothing! Assuming things without stating what you assume is pointless. Furthermore, the OP asks whether the trivial regex is the best way, or if there's another way. Hence that my answer starts with For general HTML files. Besides, if the OP is really in control of what's in the HTML files, the best answer is to not put in stuff in the files that you don't want to have there.

Abigail


In reply to Re: Removing underline tags with regexp (is a good idea) by Abigail-II
in thread Removing underline tags with regexp by Tricky

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.