
On Tue, 15 Feb 2022 at 13:57, Tim Peters <tim.peters@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