Unicon Patterns Quick Summary

Pattern match operation

SUBJECT ?? PATTERN suspends substring matched by pattern resumes after the end of the last substring matched
SUBJECT ?? PATTERN := REPLACEMENT replaces the substring matched with REPLACEMENT

Pattern Construction Operations

PAT1 &&  PAT2 Subsequent, matches PAT1 followed by PAT2
PAT1 .| PAT2 Alternate, matches PAT1 or PAT2
PATTERN -> NAME Conditional assignment of matched substring to variable
.$
Copy cursor position to variable
$$
Immediate assignment of matched substring to variable
` `
Unevaluated variable or function (discards result in case of functions and the pattern  succeeds if the function succeeded
`` ``
Unevaluated function (pattern succeeds if the result of the function matches)


Pattern Functions


PArb()
Arbitrary number of characters
PRest()
Remainder of subject
PLen(I)
Match string of specified length
PPos(I)
Match null string at specified cursor position
PRpos(I)
Match null string at specified cursor position counting from subject end
PTab(I)
Match to specified cursor position
PRTab(I)
Match to specified cursor position counting from end
PAny(S)
Match one character if it appears in S
PNotAny(S)
Match one character if it does not appear in S
PBreak(S) Match run of characters up to a character in S
PBreakx(S)
Like PBreak(S), but can extend past first match
PSpan(S)
Match one or more characters if they appear in S