How to select multiple lines

Matthijs van Aalten matthijs.van.aalten at nxp.com
Tue Sep 8 09:27:04 CEST 2009


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: discuss-bounces at nedit.org [mailto:discuss-bounces at nedit.org] 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 - Discuss at nedit.org
http://www.nedit.org/mailman/listinfo/discuss


More information about the Discuss mailing list