RE: How to select multiple lines
Matthijs van Aalten <[email protected]>
| Newsgroups | gmane.editors.nedit.user |
|---|---|
| Message-ID | <A2403073D589354FB342892C1CB8F90607D79C23FF@EU1RDCRDC1WX029.exi.nxp.com> |
Hi, Try the following search/replace: Search for: "(?n(^module toto ;\n).*(^endmodule\n))" Replace with: "\1\2" (enable reg. expression search, of course) (and only the part within the double quotes - not the double quotes themselves) Your problem is that regular expressions in NEdit by default do not match newlines, so your part with ".+" does not match multiple lines. If you make a regular expression with the construction "(?n<regexp>)", it does match newlines. See menu "Help => Regular Expressions => Parenthetical Constructs" for more information on this topic. The rest is standard stuff: search for a line starting with 'module toto ;' and a newline, keep this line in buffer #1; then match one or more characters including newlines, then match a line starting with 'endmodule' and a newline (and keep this line in buffer #2). Replace all this with the content of buffers #1 and #2. Regards, Matthijs van Aalten -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Eric Bouyoux Sent: Tuesday 8 September 2009 9:14 To: General NEdit discussion list Subject: How to select multiple lines Hi, The title is not very explicit. Let's have an example. My file contains : module toto ; ... (1000 lines of code) endmodule I want to remove all lines between "module toto" and "endmodule". One possibility is to select all lines between the 2 keywords and to remove them. But how can I do this automaticaly ? I tried with the replace function and the following reg exp but it didn't work (^module.+endmodule). Regards. Eric Bouyoux. -- NEdit Discuss mailing list - [email protected] http://www.nedit.org/mailman/listinfo/discuss -- NEdit Discuss mailing list - [email protected] http://www.nedit.org/mailman/listinfo/discuss