Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ multiline regex

Tags:

I've got hundreds of files of the type linked here: http://pastebin.com/fGgLfZf8

But I want to remove all the comments that occupies more than one line eg.

<!--- MPU ---> 

should be left untouched, while

<!--
************
blablabla
************
-->

should be removed.

I know the Notepad++ feature to lookup through more than a document with regexp and I'm tryin to use it but I have some difficulty. For a start I'm trying this regexp:

<\!\-\-(.*?)\-\->

which tested in here: http://www.regextester.com/ works at least partially (because it highlights the comments made of just on line) But if I copy and paste this regexp on Notepad++ it will match just the one-line comments =\

Does anybody know how to do this in Notepad++?

like image 927
Andrea Silvestri Avatar asked Dec 18 '12 13:12

Andrea Silvestri


2 Answers

Next to the "Regular expression" selection in "Search Mode" there is a "matches newline" checkbox (according to @glatapoui it should be noted that this only works in Notepad++ v6, not in previous versions).

enter image description here

like image 127
lilwupster Avatar answered Sep 21 '22 02:09

lilwupster


This expression <!--.+?(?<=[\*\r\n])--> matched the multi-line comments only in Notepad++ as well.

like image 28
Mike Perrenoud Avatar answered Sep 21 '22 02:09

Mike Perrenoud