<regular expression> ::= <regular term> ['|' <regular term> ...]
<regular term> ::= <regular factor> ...
<regular factor> ::= <regular primary> [<quantifier>]
<quantifier> ::= ? | * | + | '{' <m> [,[<n>]] '}'
<m>, <n> ::= целые положительные числа, если присутвуют оба числа, то <m> <= <n>
<regular primary> ::=
<character> | <character class> | %
| (<regular expression>)
<character> ::= <escaped character> | <non-escaped character>
<escaped character> ::=
<escape-char> <special character> | <escape-char> <escape-char>
<special character> ::= любой из символов []()|^-+*%_?{}
<non-escaped character> ::=
любой символ за исключением <special character>
и не эквивалентный <escape-char> (если задан)
<character class> ::=
'_' | '[' <member> ... ']' | '[^' <non-member> ... ']'
| '[' <member> ... '^' <non-member> ... ']'
<member>, <non-member> ::= <character> | <range> | <predefined class>
<range> ::= <character>-<character>
<predefined class> ::= '[:' <predefined class name> ':]'
<predefined class name> ::=
ALPHA | UPPER | LOWER | DIGIT | ALNUM | SPACE | WHITESPACE