<div dir="ltr">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.</div><br><div class="gmail_quote"><div dir="ltr">On Sat, Oct 6, 2018 at 11:22 AM Serhiy Storchaka <<a href="mailto:storchaka@gmail.com">storchaka@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">06.10.18 10:22, Ram Rachum пише:<br>
> I'd like to use the re module to parse a long text file, 1GB in size. I <br>
> wish that the re module could parse a stream, so I wouldn't have to load <br>
> the whole thing into memory. I'd like to iterate over matches from the <br>
> stream without keeping the old matches and input in RAM.<br>
<br>
How would you match 'a.*b' without loading the whole thing into memory?<br>
<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div>