<ch> ::= any typable character
<digit> ::= any digit from '0' to '9'
<digits> ::= <digit> { <digit> }
<digit19> ::= any digit from '1' to '9'
<hext> ::= any digit or letter from 'a' to 'f' or 'A' to 'F'
Basic character definitions :-
<c> ::= '\n' newline
| '\t' tab
| '\r' carriage return
| '\b' backspace
| '\f' formfeed
| '\e' escape
| '\x' <hex> ( <hex> ) specify character in hex, one or two hex digits
| '\' <ch> other character, escaping any special meaning
| <ch> normal character
Bracket element (something which goes in a bracket expression) :-
<be> ::= <c> a character
| <c> '-' <c> a range of characters
| '[:alnum:]' POSIX alphanumeric characters
| '[:alpha:]' POSIX alphabetic characters
| '[:blank:]' POSIX space and tab characters
| '[:cntrl:]' POSIX control characters
| '[:digit:]' POSIX numeric characters
| '[:graph:]' POSIX printable and visible (non-space) chars
| '[:lower:]' POSIX lowercase characters
| '[:print:]' POSIX alphanumeric characters
| '[:punct:]' POSIX punctuation characters
| '[:space:]' POSIX whitespace characters
| '[:upper:]' POSIX uppercase characters
| '[:xdigit:]' POSIX hexadecimal digits
| '[.' ??? '.]' POSIX collating symbols and
| '[=' ??? '=]' POSIX equivelence classes
ARE NOT SUPPORTED
Bracket expression :-
<bx> ::= [ '^' ] { <be> } defines a set of acceptable characters
or a set of non-acceptable (if '^' present)
Extended Regular Expression :-
<re> ::= empty regular expression
| <c> character
| '~' <c> not specified character
shorthand for '[^' <c> ']'
| '\w' matches any 'word consituent' character
shorthand for '[[:alnum:]_]'
| '\W' matches any non 'word consituent' character
shorthand for '[^[:alnum:]_]'
| '.' matches any character (but not end of line)
| '[' <bx> ']' matches characters in the bracket expression
| '^' matches empty string at the start of the 'line'
| '$' matches empty string at the end of the 'line'
| '\`' synonym for '^'
| '\'' synonym for '$'
| '\<' matches empty string at the start of a 'word'
| '\>' matches empty string at the end of a 'word'
| '\B' matches empty string within 'word'
| '\y' matches empty string at start or end of 'word'
shorthand for '(\<|\>)'
note: not '\b', as this clashes with backspace
| <re> <re> 2 <re>'s concatenated form a <re>
| '(' <re> ')' nested regular expression
| '\' <digit19> backreference to nested regular expression
| <re> '?' zero or one occurrance of <re>
| <re> '+' one or more occurrances of <re>
| <re> '*' zero or more occurrances of <re>
| <re> '{' <digits> '}' matches M occurances of <re>
| <re> '{' <digits> ',}' matches at least M occurances of <re>
| <re> '{' <digits> ',' <digits> '}'
matches between M and N occurances of <re>
| <re> '|' <re> matches one <re> or the other