Piraha Reference Card

Pattern ElementMeaning
[a-fx]Square brackets denote a character class. The pattern at left can match the letters a-f or x. Piraha has no pre-defined character classes and does not support the notions of unions or intersections insided character classes available in Java's regular expression package.
[^a-fx]This is a negated character entity. It will match any character except a-f or x.
[^]This pattern will match any character.
x{n,m}The quantifier pattern will match the pattern x a minimum of n and a maximum of m times.
x{n,}This version of the quantifier pattern will match n or more occurrences of x
x{,m}This version of the quantifier pattern will match at most m occurrences of x
x+A shorthand for x{1,}
x*A shorthand for x{0,}
x?A shorthand for x{0,1}
\1Match the first backreference within this rule. Any of backreferences 1 to 9 may be matched by using \2, \3, etc.
{name}Match the pattern named by name. Save the match in a backreference.
{-name}Match the pattern named by name, but do not capture backreferences.|
(?=x)Match the pattern x as a zero-width lookahead assertion
(?!x)A negative zero-width lookahead assertion for pattern x
(x|y|z)An ordered set of preferred ways to match. If pattern x does not succeed, try pattern y, and then z. There can be any number of alternatives in this set.
\bA word boundary. A word is composed of letters, numbers, and the underscore.
$Match the end of the string.
^Match the beginning of the string.
(?i:x)Ignore case when matching x.
(?-i:x)Do not ignore case when matching x.|
{OpenWhite}A zero-width lookahead assertion that a new indentation level has opened, starting at the current position.
{CloseWhite}A zero-width lookahead assertion that an indentation level has closed, starting at the current position.
{BodyWhite} Match the current indentation level. Initially this will be zero. It will increase when {OpenWhite} successfully matches, and decrease when {CloseWhite} successfully matches.