in reply to Re: Re: Range This
in thread Efficiently Extracting a Range of Lines (was: Range This)

You're using a "here"-style document, so it will fit in RAM, or your program won't run. If you were pulling stuff from a file external to your program, you have a few other options which might minimize memory usage, but only if the stuff you're removing is significantly larger than the stuff you're keeping.

The regex, as shown there, can handle any string you throw at it, even if that string were several hundred meg of data. Not that I would recommend using a here document that was that large, but you get the idea.