On Tue, 15 Feb 2022 at 13:57, Tim Peters <tim.pet...@gmail.com> wrote: > In SNOBOL, as I recall, it could be spelled > > ARB "spam" FENCE > > Those are all pattern objects, and infix whitespace is a binary > pattern catenation operator. > > ARB is a builtin pattern that matches the empty string at first, and > extends what it matches by one character each time it's backtracked > into. > > "spam" matches the obvious string. > > Then FENCE is a builtin pattern that matches an empty string, but acts > as a backtracking barrier: if the overall match attempt fails, > backtracking will not move "to the left" of FENCE. So, here, ARB will > not get a chance to consume more characters after the leftmost "spam" > is found.
Ah, so that's a bit more complicated than the "no-backtracking" parsing style of REXX and scanf. Does this guarantee anything about performance, or is it primarily to allow you to write patterns that can't mismatch strings? ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/I7B5HFMA36SY3C5MYGEKX5LAH2ELMM2T/ Code of Conduct: http://python.org/psf/codeofconduct/