This tool takes HTML content as input and removes HTML comments according to the chosen mode. Use the provided radio buttons to select a mode. If you choose to remove only comments matching a pattern, specify the text pattern in the custom field. Conditional comments (used in legacy IE code) can be optionally retained.
Examples:
Remove All HTML Comments
Strips every comment from the HTML.
Before:
<p>Hello <!-- This is a comment --> World</p>
After:
<p>Hello World</p>
Remove Only Comments Matching a Pattern
Removes only comments that contain the pattern "DEBUG".
Before:
<p>Hello <!-- DEBUG: remove this comment --> World</p> <p>Keep this <!-- NOTE: keep this comment --> intact</p>
After (with pattern "DEBUG"):
<p>Hello World</p> <p>Keep this <!-- NOTE: keep this comment --> intact</p>
Remove All Except Conditional Comments
Removes standard comments while keeping conditional comments.
Before:
<p>Hello <!-- Remove this comment --> World</p> <!--[if IE]>Special instructions for IE<![endif]-->
After:
<p>Hello World</p> <!--[if IE]>Special instructions for IE<![endif]-->