### Additional Syntax Specifiers in Extended Regular Expressions

The syntax specifiers used in Basic Regular Expressions (BREs), with the exception of backreferencing, also apply for Extended Regular Expressions (EREs). In addition, you can use specifiers that are not valid for BREs. The following table shows the complete list of syntax specifiers that can be used with an ERE:

Syntax Specifier | Description
--- | ---
(expression) | Matches expression. You only need to enclose an expression in these delimiters to use operators (such as * or +) on it.
expression* | Matches zero or more consecutive occurrences of what expression matches. expression can be a single character or collating symbol, or a subexpression. For example, `[ab]*` matches `ab` and `ababab`; `b*cd` matches characters 3 to 7 of `cabbbcdeb`.
expression{m} | Matches exactly m occurrences of expression. expression can be a single character or collating symbol, or a subexpression. For example, `c{3}` matches characters 5 through 7 of `ababccccd` (the first 3 `c` characters only).
expression{m,} | Matches at least m occurrences of expression . expression can be a single character or collating symbol, or a subexpression. For example, `(ab){3,}` matches `abababab` , but does not match `ababac` .
expression{m,u} | Matches any number of occurrences, between m and u inclusive, of expression. expression can be a single character or collating symbol, or a subexpression. For example, `bc{1,3}` matches characters 2 through 4 of `abccd` and characters 3 through 6 of `abbcccccd`.
^expression | Matches expression only if expression starts at the first character of a string or after a new-line character if the REG_NEWLINE flag was specified for the regcomp function. For example, `^ab` matches `ab` in the string`abcdef` , but does not match it in the string `cdefab`. The expression can be the entire RE or any subexpression of it. When ^ is the first character of a subexpression, other implementations could interpret it as a literal character. To ensure portability, avoid using ^ at the beginning of a subexpression; to use it as a literal character, precede it with a backslash.
expression$ | Matches expression only if expression is at the end of the string or if it precedes the new-line character if the REG_NEWLINE flag was specified for the regcomp function. For example, `ab$` matches `ab` in the string `cdefab` but does not match it in the string `abcdef`. The expression must be the entire RE. When $ is the last character of a subexpression, it is treated as a literal character. Other implementations could interpret is as described above. To ensure portability, avoid using $ at the end of a subexpression; to use it as a literal character, precede it with a backslash.
^expression$ | Matches only an entire string, or an entire line if the REG_NEWLINE flag was specified for the regcomp function. For example, `^abcde$` matches only `abcde`.
expression+ | Matches one or more occurrences of expression. For example, `a+(bc)` matches `aaaaabc` ; `(bc)+` matches characters 1 through 6 of `bcbcbcbb`.
expression? | Matches zero or one consecutive occurrences of what expression matches. For example,`b?c` matches character 2 of `acabbb` (zero occurrences of `b` followed by `c` ).
expression|expression | Matches either expression. For example, `a((bc)|d)` matches both `abc` and `ad`.

Regular Expressions