1
2re2c uses the following syntax for regular expressions:
3
4*    ``"foo"`` case-sensitive string literal
5
6*    ``'foo'`` case-insensitive string literal
7
8*    ``[a-xyz]``, ``[^a-xyz]`` character class (possibly negated)
9
10*    ``.`` any character except newline
11
12*    ``R \ S`` difference of character classes ``R`` and ``S``
13
14*    ``R*`` zero or more occurrences of ``R``
15
16*    ``R+`` one or more occurrences of ``R``
17
18*    ``R?`` optional ``R``
19
20*    ``R{n}`` repetition of ``R`` exactly ``n`` times
21
22*    ``R{n,}`` repetition of ``R`` at least ``n`` times
23
24*    ``R{n,m}`` repetition of ``R`` from ``n`` to ``m`` times
25
26*    ``(R)`` just ``R``; parentheses are used to override precedence or for POSIX-style submatch
27
28*    ``R S`` concatenation: ``R`` followed by ``S``
29
30*    ``R | S`` alternative: ``R or S``
31
32*    ``R / S`` lookahead: ``R`` followed by ``S``, but ``S`` is not consumed
33
34*    ``name`` the regular expression defined as ``name`` (or literal string ``"name"`` in Flex compatibility mode)
35
36*    ``{name}`` the regular expression defined as ``name`` in Flex compatibility mode
37
38*    ``@stag`` an *s-tag*: saves the last input position at which ``@stag`` matches in a variable named ``stag``
39
40*    ``#mtag`` an *m-tag*: saves all input positions at which ``#mtag`` matches in a variable named ``mtag``
41
42Character classes and string literals may contain the following escape sequences:
43``\a``, ``\b``, ``\f``, ``\n``, ``\r``, ``\t``, ``\v``, ``\\``, octal escapes ``\ooo`` and hexadecimal escapes ``\xhh``, ``\uhhhh`` and ``\Uhhhhhhhh``.
44
45