Siteswap generator regular expression syntax

If you are interested in using the full capabilities of regular expression matching, I would suggest reading one of the many good tutorials available on the web (for example, try A Tao of Regular Expressions). Within Juggling Lab, the standard regular expression metacharacters []()| require quoting with a backslash '\' to avoid conflicting with the use of these characters in siteswap notation.

The full regular expression syntax accepted by Juggling Lab is described below. This documentation is adapted from the Jakarta-Regexp documentation.

Characters

   Char          Matches any identical character

Character Classes

   \[abc\]       Simple character class
   \[a-zA-Z\]    Character class with ranges
   \[^abc\]      Negated character class

Standard POSIX Character Classes

   \[:alnum:\]   Alphanumeric characters
   \[:alpha:\]   Alphabetic characters
   \[:digit:\]   Numeric characters

Predefined Classes

   .             Matches any character other than newline
   \d            Matches a digit character
   \D            Matches a non-digit character

Boundary Matchers

   ^             Matches only at the beginning of a line
   $             Matches only at the end of a line

Greedy Closures

   A*            Matches A 0 or more times (greedy)
   A+            Matches A 1 or more times (greedy)
   A?            Matches A 1 or 0 times (greedy)
   A{n}          Matches A exactly n times (greedy)
   A{n,}         Matches A at least n times (greedy)
   A{n,m}        Matches A at least n but not more than m times (greedy)

Reluctant Closures

   A*?           Matches A 0 or more times (reluctant)
   A+?           Matches A 1 or more times (reluctant)
   A??           Matches A 0 or 1 times (reluctant)

Logical Operators

   AB            Matches A followed by B
   A\|B          Matches either A or B
   \(A\)         Used for subexpression grouping
   \(?:A\)       Used for subexpression clustering (just like grouping but no backrefs)

Backreferences

   \1            Backreference to 1st parenthesized subexpression
   \2            Backreference to 2nd parenthesized subexpression
   \3            Backreference to 3rd parenthesized subexpression
   \4            Backreference to 4th parenthesized subexpression
   \5            Backreference to 5th parenthesized subexpression
   \6            Backreference to 6th parenthesized subexpression
   \7            Backreference to 7th parenthesized subexpression
   \8            Backreference to 8th parenthesized subexpression
   \9            Backreference to 9th parenthesized subexpression

You can refer to the contents of a parenthesized expression within a regular expression itself. This is called a 'backreference'. The first backreference in a regular expression is denoted by \1, the second by \2 and so on. So the expression:

\(\[0-9\]+\)=\1

will match any string of the form n=n (like 0=0 or 2=2).

All closure operators (+, *, ?, {m,n}) are greedy by default, meaning that they match as many elements of the string as possible without causing the overall match to fail. If you want a closure to be reluctant (non-greedy), you can simply follow it with a '?'. A reluctant closure will match as few elements of the string as possible when finding matches. {m,n} closures don't currently support reluctancy.


Valid XHTML 1.0!