NotePad++: Remove multi-line (/**/) comments automatically 3


We are going to use NotePad++ replace functionality (CTRL+H) to remove all multi-line comments that are enclosed in a pair of /* and */.

While in the source file you want to edit, open up the ‘Replace’ window either from the ‘Search’ menu or by using CTRL+H.

Set ‘Search Mode’ to ‘Regular expression’ and tick the ‘. matches newline’.

In the ‘Find what:’ input type /\*(.*?)\*/\n and leave the ‘Replace with:’ input empty.

NotePad++ Remove Multi-Line CommentsTo find the next comment, you can click the ‘Find Next’ button and then hit ‘Replace’.

To make the change on all comments just hit ‘Replace All’.


Leave a Reply

3 thoughts on “NotePad++: Remove multi-line (/**/) comments automatically

    • George Michael

      Using Notepad++ you can select a range of lines and delete them following the procedure below:
      Press Ctrl + G, type the start line and hit Enter to go to the start line.
      Then go to the menu, click on Edit and then Begin/End select.
      Press again Ctrl + G, and type the end line number and hit Enter to go to it.
      Back to the menu, click on Edit and then Begin/End select once more.
      By now you will have your range of lines to be deleted selected so just press Backspace or Delete.