# Regex Model Syntax

The regex model uses the following syntax:

Code | Definition
--- | ---
. | Matches any character, except for space.
[A-Za-z] | Matches any English character. See "Character classes" below.
[^A-Z] | Matches any character, except for space and the upper case characters.
\d, \u | Equivalent to [0-9] and [A-Z] respectively.
jan|feb | Matches either "jan" or "feb"
() | Groups characters. Useful if followed by ?, *, +, or {5}, or to delimit the range of or an either/or expression using |.
space | Space is special. It does not match any feature, but tells the Blue Read tool's model matcher to expect a longer gap between features here, which affects the scoring.
\*, \?, \+, \(, \), \[, \], \{, \}, \., \|, \\ | Escapes a literal control character.
? | The preceding expression is optional.
* | The preceding expression repeats 0 or more times.
+ | The preceding expression repeats 1 or more times.
{5} | The preceding expression repeats exactly 5 times.
{5,8} | The preceding expression repeats 5 to 8 times, inclusive.
Other character | Matches that character literally.

Inside of character classes (e.g. [a-z]) the following syntax rules apply:

- A - denotes a range, unless it occurs at the beginning of the class specification (possibly after ^) or at the end. If you need a literal -, place it in one of those locations.
- A closing square bracket ] ends the class, unless it is escaped with \, or it occurs at the very beginning of the class specification (possibly after ^).

- If you want a backslash, you should escape it with another backslash.

  Note: The only characters with special meaning are ], -, and \. Any other character (e.g. *, ?, ), |, etc) have their literal meanings, and should not be escaped.