Re: Mental model of lookahead assertions

2020-02-28 Thread Jon Ribbens via Python-list
On 2020-02-27, Stefan Ram wrote: > One can count overlapping occurences as follows. > >|>>> print(len(findall('(?=aa)','cb'))) >|3 > > Every web page says that lookahead assertions do > not consume nor move the "current position". > > But what mental model can I make of the regex > e

Re: Mental model of lookahead assertions

2020-02-27 Thread Python
Stefan Ram wrote: One can count overlapping occurences as follows. |>>> print(len(findall('(?=aa)','cb'))) |3 Every web page says that lookahead assertions do not consume nor move the "current position". But what mental model can I make of the regex engine that explains why