From: Robert Klemme Date: 2003-12-03T23:17:05+09:00 Subject: Re: Some Regexp "Hugh Sasse Staff Elec Eng" schrieb im Newsbeitrag news:Pine.GSO.4.58.0312031220260.10895@neelix... > On Wed, 3 Dec 2003, Dmitry V. Sabanin wrote: > > > Something like this should help: > > > > open = "TEXT1" > > close = "TEXT2" > > array = data.scan(/#{Regexp::quote(open)}(.*?)#{Regexp::quote(close)}/m).flatten > > > > I get: > > array == ["\nsome text, tabs, CRLF etc 1\n", "\nsome text, tabs, CRLF etc 2\n", "\nsome text, tabs, CRLF etc 3\n"] > > with your data. > > Interesting. This doesn't cope with nesting though. I've just > tried that out. Is there a good way to do that with scan? Do you mean nesting of TEXT1...TEXT2 sections within each other? That can't be done with regexps. You need a context free parser for that. Cheers robert