namespace
<regex>

std::regex_constants

regex constants
This namespace declares three bitmask types used with elements of the regex library along with constant values of these types:

Each of these bitmask types may have been implemented in your library either as an enumerated type, an integer type, or a bitset. In any case, it can take one or more flags of that same type as value by combining them using the bitwise OR operator (|):
 
bitmask_type object = flag1 | flag2 | flag3;


By providing these values under a specific namespace, you have the option to include this namespace (with using namespace std::regex_constants) directly in your code in order to refer to these values more easily independently on whether you include the more generic namespace std or not.

Bitmask type syntax_option_type

Aliased as member type flag_type in regex (and basic_regex), it is used in the construction or assignment of regex objects to specify the syntax used by the object. The possible values it can take are:

flageffects on syntaxnotes
icaseCase insensitiveRegular expressions match without regard to case.
nosubsNo sub-expressionsThe match_results structure will not contain sub-expression matches.
optimizeOptimize matchingMatching efficiency is preferred over efficiency constructing regex objects.
collateLocale sensitivenessCharacter ranges, like "[a-b]", are affected by locale.
ECMAScriptECMAScript grammarThe regular expression follows one of these grammars.
One (and only one) of these six grammar flags needs to be set for the bitmask to have a valid value.
basicBasic POSIX grammar
extendedExtended POSIX grammar
awkAwk POSIX grammar
grepGrep POSIX grammar
egrepEgrep POSIX grammar
flageffects on syntaxnotes
icaseCase insensitiveRegular expressions match without regard to case.
nosubsNo sub-expressionsSub-expressions are not considered to be marked.
The match_results structure will not contain sub-expression matches.
optimizeOptimize matchingMatching efficiency is preferred over efficiency constructing regex objects.
collateLocale sensitivenessCharacter ranges, like "[a-b]", are affected by locale.
ECMAScriptECMAScript grammarThe regular expression follows one of these grammars.
At most one of these six grammar flags can be set for the bitmask to have a valid value. If none is set, ECMAScript is assumed.
basicBasic POSIX grammar
extendedExtended POSIX grammar
awkAwk POSIX grammar
grepGrep POSIX grammar
egrepEgrep POSIX grammar

Bitmask type match_flag_type

Used as a parameter to functions regex_match, regex_search and regex_replace and also as a parameter to the constructors of regex_iterator and regex_token_iterator.

flageffectsnotes
match_defaultDefaultDefault matching behavior.**.
match_not_bolNot Beginning-Of-LineThe first character is not considered a beginning of line ("^" does not match).
match_not_eolNot End-Of-LineThe last character is not considered an end of line ("$" does not match).
match_not_bowNot Beginning-Of-WordThe escape sequence "\b" does not match as a beginning-of-word.
match_not_eowNot End-Of-WordThe escape sequence "\b" does not match as an end-of-word.
match_anyAny matchAny match is acceptable if more than one match is possible.
match_not_nullNot nullEmpty sequences do not match.
match_continuousContinuousThe expression must match a sub-sequence that begins at the first character.
Sub-sequences must begin at the first character to match.
match_prev_availPrevious AvailableOne or more characters exist before the first one. (match_not_bol and match_not_bow are ignored)
format_defaultDefault formattingUses the standard formatting rules to replace matches (those used by ECMAScript's replace method).**.
format_sedsed formattingUses the same rules as the sed utility in POSIX to replace matches.
format_no_copyNo copyThe sections in the target sequence that do not match the regular expression are not copied when replacing matches.
format_first_onlyFirst onlyOnly the first occurrence of a regular expression is replaced.
** These constants have an empty bitmask value and are ignored when combined with some other flag value.

Bitmask type error_type

Used as by the regex_error to identify the kind of error that threw the exception:

flagerror
error_collateThe expression contained an invalid collating element name.
error_ctypeThe expression contained an invalid character class name.
error_escapeThe expression contained an invalid escaped character, or a trailing escape.
error_backrefThe expression contained an invalid back reference.
error_brackThe expression contained mismatched brackets ([ and ]).
error_parenThe expression contained mismatched parentheses (( and )).
error_braceThe expression contained mismatched braces ({ and }).
error_badbraceThe expression contained an invalid range between braces ({ and }).
error_rangeThe expression contained an invalid character range.
error_spaceThere was insufficient memory to convert the expression info a finite state machine.
error_badrepeatThe expression contained a repeat specifier (one of *?+{) that was not preceded by a valid regular expression.
error_complexityThe complexity of an attempted match against a regular expression exceeded a pre-set level.
error_stackThere was insufficient memory to determine whether the regular expression could match the specified character sequence.