| Home | Libraries | People | FAQ | More

#### Options for POSIX Basic Regular Expressions

Exactly one of the following must always be set for POSIX basic regular expressions:

Element | Standardized | Effect When Set
--- | --- | ---
basic | Yes | Specifies that the grammar recognized by the regular expression engine is the same as that used by POSIX basic regular expressions in IEEE Std 1003.1-2001, Portable Operating System Interface (POSIX ), Base Definitions and Headers, Section 9, Regular Expressions (FWD.1).
sed | No | As Above.
grep | Yes | Specifies that the grammar recognized by the regular expression engine is the same as that used by POSIX utility `grep` in IEEE Std 1003.1-2001, Portable Operating System Interface (POSIX ), Shells and Utilities, Section 4, Utilit\ies, grep (FWD.1). That is to say, the same as POSIX basic syntax, but with the newline character acting as an alternation character; the expression is treated as a newline separated list of alternatives.
emacs | No | Specifies that the grammar recognised is the superset of the POSIX-Basic syntax used by the emacs program.

The following options may also be set when using POSIX basic regular expressions:

Element | Standardized | Effect when set
--- | --- | ---
icase | Yes | Specifies that matching of regular expressions against a character container sequence shall be performed without regard to case.
nosubs | Yes | Specifies that when a regular expression is matched against a character container sequence, then no sub-expression matches are to be stored in the supplied `match_results` structure.
optimize | Yes | Specifies that the regular expression engine should pay more attention to the speed with which regular expressions are matched, and less to the speed with which regular expression objects are constructed. Otherwise it has no detectable effect on the program output. This currently has no effect for Boost.Regex.
collate | Yes | Specifies that character ranges of the form `[a-b]` should be locale sensitive. This bit is on by default for POSIX-Basic regular expressions, but can be unset to force ranges to be compared by code point only.
newline_alt | No | Specifies that the \n character has the same effect as the alternation operator |. Allows newline separated lists to be used as a list of alternatives. This bit is already set, if you use the `grep` option.
no_char_classes | No | When set then character classes such as `[[:alnum:]]` are not allowed.
no_escape_in_lists | No | When set this makes the escape character ordinary inside lists, so that `[\b]` would match either '\' or 'b'. This bit is on by default for POSIX-basic regular expressions, but can be unset to force escapes to be recognised inside lists.
no_intervals | No | When set then bounded repeats such as a{2,3} are not permitted.
bk_plus_qm | No | When set then `\?` acts as a zero-or-one repeat operator, and `\+` acts as a one-or-more repeat operator.
bk_vbar | No | When set then `\|` acts as the alternation operator.
no_except | No | Prevents `basic_regex` from throwing an exception when an invalid expression is encountered.
save_subexpression_location | No | When set then the locations of individual sub-expressions within the original regular expression string can be accessed via the `subexpression()` member function of `basic_regex`.