Eliminating HTML Comments and Retaining Code via Notepad++

Notepad++ has a syntax highlighter that identifies doc comments, but it doesn’t analyze them to produce autocomplete code or provide a snippet feature to insert doc comments. An inquiry was made about removing HTML comments from an HTML file in Notepad++.


How can I remove everything from an HTML file except the code? I’m interested in learning the process and whether I can achieve it using search/replace.
comments in notepad++
regular expression

Solution 1:

I would use

Oscar’s solution is less permissive compared to the more robust option.

Solution 2:

Despite my efforts to locate an uncomplicated remedy, I devised my own and am eager to share it.

Choose “Regular” option and leave the corresponding field empty, as shown in
Expression” – Replace


Ensure thorough inspection before and after to prevent loss of actual code. I personally did not experience any code loss.

i hope it helps

Frequently Asked Questions