It'll load as much as it needs to in order to match or rule out a match on a pattern. If you'd try to match `a.*b` it'll load the whole thing. The use cases that are relevant to a stream wouldn't have these kinds of problems.

On Sat, Oct 6, 2018 at 11:22 AM Serhiy Storchaka <> wrote:
06.10.18 10:22, Ram Rachum пише:
> I'd like to use the re module to parse a long text file, 1GB in size. I
> wish that the re module could parse a stream, so I wouldn't have to load
> the whole thing into memory. I'd like to iterate over matches from the
> stream without keeping the old matches and input in RAM.

How would you match 'a.*b' without loading the whole thing into memory?

Python-ideas mailing list
Code of Conduct: