Syntax rules for regular expression matching in Fossil:
Pattern | Match | ||
---|---|---|---|
X* | Zero or more occurrences of X | ||
X+ | One or more occurrences of X | ||
X? | Zero or one occurrences of X | ||
X{P,Q} | Between P and Q occurrences of X | ||
(X) | X | ||
X|Y | X or Y | ||
^X | X at the beginning of the string | ||
X$ | X at the end of the string | ||
. | Any single character | ||
\C | Character C if C is one of: \{}()[]|*+? | ||
\C | C-language escapes if C is one of: afnrtv | ||
\uHHHH | Unicode character U+HHHH where HHHH is four hex digits | ||
\HH | Unicode character U+00HH where HH is two hex digits | ||
[abc] | Any single character from abc | ||
[^abc] | Any single character not in abc | ||
[a-z] | Any single character between a and z, inclusive | ||
[^a-z] | Any single character not between a and z | ||
\b | Word boundary | ||
\w | A word character: a-zA-Z0-9 or _ | ||
\W | A non-word character | ||
\d | A digit. 0-9 | ||
\D | A non-digit character | ||
\s | A whitespace character | ||
\S | A non-whitespace character |
In the "Pattern" column of the table above:
- "X" and "Y" mean any subpattern
- "P" and "Q" mean integers
- "C" means a single character
- "H" means a hexadecimal digit
- "abc" means any sequences of one or more characters
- "a-z" means any single character, a single "-" character, and then one additional character.
- All other symbols in the patterns are literal text
The "X|Y" pattern has lower precedence than the others. Use "(...)" for grouping, as necessary.