##- # Author: Brian Tiffin # Dedicated to the public domain # # Date: November 2016 # Modified: 2016-11-27/22:12-0500 ##+ # # Pos.icn, SNOBOL pattern matching function, test position # procedure main() # Pattern matching positional test "string" ?? Span('pqrstuv') => first || Pos(4) || Tab(0) => rest write(image(first), " ", image(rest)) # enforce anchored pattern matching with unachored Span "no match at start of string" ?? Pos(1) || Span('rst') => second # second will be unset write(image(second)) # same again, without positional test, Span allowed to scan forward "ok, no match at start of string" ?? Span('rst') => third write(image(third)) end