The namespace std::regex_constants holds symbolic constants used by the regular expression library. This namespace provides three types, syntax_option_type, match_flag_type, and error_type, along with several constants of these types.
31.5.1 Bitmask type syntax_option_type [re.synopt]namespace std::regex_constants { using syntax_option_type = T1; inline constexpr syntax_option_type icase = unspecified; inline constexpr syntax_option_type nosubs = unspecified; inline constexpr syntax_option_type optimize = unspecified; inline constexpr syntax_option_type collate = unspecified; inline constexpr syntax_option_type ECMAScript = unspecified; inline constexpr syntax_option_type basic = unspecified; inline constexpr syntax_option_type extended = unspecified; inline constexpr syntax_option_type awk = unspecified; inline constexpr syntax_option_type grep = unspecified; inline constexpr syntax_option_type egrep = unspecified; inline constexpr syntax_option_type multiline = unspecified; }
The type syntax_option_type is an implementation-defined bitmask type. Setting its elements has the effects listed in Table 130. A valid value of type syntax_option_type shall have at most one of the grammar elements ECMAScript, basic, extended, awk, grep, egrep, set. If no grammar element is set, the default grammar is ECMAScript.
Table
130—
syntax_option_typeeffects
namespace std::regex_constants { using match_flag_type = T2; inline constexpr match_flag_type match_default = {}; inline constexpr match_flag_type match_not_bol = unspecified; inline constexpr match_flag_type match_not_eol = unspecified; inline constexpr match_flag_type match_not_bow = unspecified; inline constexpr match_flag_type match_not_eow = unspecified; inline constexpr match_flag_type match_any = unspecified; inline constexpr match_flag_type match_not_null = unspecified; inline constexpr match_flag_type match_continuous = unspecified; inline constexpr match_flag_type match_prev_avail = unspecified; inline constexpr match_flag_type format_default = {}; inline constexpr match_flag_type format_sed = unspecified; inline constexpr match_flag_type format_no_copy = unspecified; inline constexpr match_flag_type format_first_only = unspecified; }
The type match_flag_type is an implementation-defined bitmask type. The constants of that type, except for match_default and format_default, are bitmask elements. The match_default and format_default constants are empty bitmasks. Matching a regular expression against a sequence of characters [first, last) proceeds according to the rules of the grammar specified for the regular expression object, modified according to the effects listed in Table 131 for any bitmask elements set.
Table
131—
regex_constants::match_flag_typeeffects when obtaining a match against a character container sequence
[first, last).
^
in the regular expression shall not match [first, first). match_not_eol The last character in the sequence [first, last) shall be treated as though it is not at the end of a line, so the character "$"
in the regular expression shall not match [last, last). match_not_bow The expression "\\b"
shall not match the sub-sequence [first, first). match_not_eow The expression "\\b"
shall not match the sub-sequence [last, last). match_any If more than one match is possible then any match is an acceptable result. match_not_null The expression shall not match an empty sequence. match_continuous The expression shall only match a sub-sequence that begins at first. match_prev_avail --first
is a valid iterator position. When this flag is set the flags match_not_bol and match_not_bow shall be ignored by the regular expression algorithms and iterators. format_default When a regular expression match is to be replaced by a new string, the new string shall be constructed using the rules used by the ECMAScript replace function in ECMA-262, part 15.5.4.11 String.prototype.replace. In addition, during search and replace operations all non-overlapping occurrences of the regular expression shall be located and replaced, and sections of the input that did not match the expression shall be copied unchanged to the output string. format_sed When a regular expression match is to be replaced by a new string, the new string shall be constructed using the rules used by the sed utility in POSIX. format_no_copy During a search and replace operation, sections of the character container sequence being searched that do not match the regular expression shall not be copied to the output string. format_first_only When specified during a search and replace operation, only the first occurrence of the regular expression shall be replaced. 31.5.3 Implementation-defined error_type [re.err]
namespace std::regex_constants { using error_type = T3; inline constexpr error_type error_collate = unspecified; inline constexpr error_type error_ctype = unspecified; inline constexpr error_type error_escape = unspecified; inline constexpr error_type error_backref = unspecified; inline constexpr error_type error_brack = unspecified; inline constexpr error_type error_paren = unspecified; inline constexpr error_type error_brace = unspecified; inline constexpr error_type error_badbrace = unspecified; inline constexpr error_type error_range = unspecified; inline constexpr error_type error_space = unspecified; inline constexpr error_type error_badrepeat = unspecified; inline constexpr error_type error_complexity = unspecified; inline constexpr error_type error_stack = unspecified; }
The type error_type is an implementation-defined enumerated type. Values of type error_type represent the error conditions described in Table 132:
Table
132—
error_typevalues in the C locale
[
and ]
. error_paren The expression contained mismatched (
and )
. error_brace The expression contained mismatched {
and }
error_badbrace The expression contained an invalid range in a {}
expression. error_range The expression contained an invalid character range, such as [b-a]
in most encodings. error_space There was insufficient memory to convert the expression into a finite state machine. error_badrepeat One of *?+{
was not preceded by a valid regular expression. error_complexity The complexity of an attempted match against a regular expression exceeded a pre-set level. error_stack There was insufficient memory to determine whether the regular expression could match the specified character sequence.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4