libstdc++
std::regex_constants Namespace Reference

5.1 Regular Expression Syntax Options

5.2 Matching Rules

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 below for any bitmask elements set.

5.3 Error Types


Detailed Description

ISO C++-0x entities sub namespace for regex.


Typedef Documentation

typedef std::bitset<_S_match_flag_last> std::regex_constants::match_flag_type

This is a bitmask type indicating regex matching rules.

The match_flag_type is implementation defined but it is valid to perform bitwise operations on these values and expect the right thing to happen.

Definition at line 191 of file regex_constants.h.

This is a bitmask type indicating how to interpret the regex.

The syntax_option_type is implementation defined but it is valid to perform bitwise operations on these values and expect the right thing to happen.

A valid value of type syntax_option_type shall have exactly one of the elements ECMAScript, basic, extended, awk, grep, egrep set.

Definition at line 73 of file regex_constants.h.


Enumeration Type Documentation

This is a bitmask type indicating regex matching rules.

The match_flag_type is implementation defined but it is valid to perform bitwise operations on these values and expect the right thing to happen.

Definition at line 168 of file regex_constants.h.

This is a bitmask type indicating how to interpret the regex.

The syntax_option_type is implementation defined but it is valid to perform bitwise operations on these values and expect the right thing to happen.

A valid value of type syntax_option_type shall have exactly one of the elements ECMAScript, basic, extended, awk, grep, egrep set.

Definition at line 47 of file regex_constants.h.

The expression contained an invalid collating element name.

Definition at line 44 of file regex_error.h.


Function Documentation

static constexpr error_type std::regex_constants::error_backref ( _S_error_backref  ) [static]

The expression contained an invalid back reference.

static constexpr error_type std::regex_constants::error_badbrace ( _S_error_badbrace  ) [static]

The expression contained an invalid range in a {} expression.

static constexpr error_type std::regex_constants::error_badrepeat ( _S_error_badrepeat  ) [static]

One of *?+{ was not preceded by a valid regular expression.

static constexpr error_type std::regex_constants::error_brace ( _S_error_brace  ) [static]

The expression contained mismatched { and }

static constexpr error_type std::regex_constants::error_brack ( _S_error_brack  ) [static]

The expression contained mismatched [ and ].

static constexpr error_type std::regex_constants::error_collate ( _S_error_collate  ) [static]

The expression contained an invalid collating element name.

static constexpr error_type std::regex_constants::error_complexity ( _S_error_complexity  ) [static]

The complexity of an attempted match against a regular expression exceeded a pre-set level.

static constexpr error_type std::regex_constants::error_ctype ( _S_error_ctype  ) [static]

The expression contained an invalid character class name.

static constexpr error_type std::regex_constants::error_escape ( _S_error_escape  ) [static]

The expression contained an invalid escaped character, or a trailing escape.

static constexpr error_type std::regex_constants::error_paren ( _S_error_paren  ) [static]

The expression contained mismatched ( and ).

static constexpr error_type std::regex_constants::error_range ( _S_error_range  ) [static]

The expression contained an invalid character range, such as [b-a] in most encodings.

static constexpr error_type std::regex_constants::error_space ( _S_error_space  ) [static]

There was insufficient memory to convert the expression into a finite state machine.

static constexpr error_type std::regex_constants::error_stack ( _S_error_stack  ) [static]

There was insufficient memory to determine whether the regular expression could match the specified character sequence.


Variable Documentation

Specifies that the grammar recognized by the regular expression engine is that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is identical to syntax_option_type extended, except that C-style escape sequences are supported. These sequences are: \\, \a, \b, \f, \n, \r, \t , \v, \', ', and \ddd (where ddd is one, two, or three octal digits).

Definition at line 137 of file regex_constants.h.

Specifies that the grammar recognized by the regular expression engine is 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 [IEEE, Information Technology -- Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].

Definition at line 119 of file regex_constants.h.

Specifies that character ranges of the form [a-b] should be locale sensitive.

Definition at line 100 of file regex_constants.h.

Referenced by std::regex_traits::transform().

Specifies that the grammar recognized by the regular expression engine is that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript Language Specification, Standard Ecma-262, third edition, 1999], as modified in section [28.13]. This grammar is similar to that defined in the PERL scripting language but extended with elements found in the POSIX regular expression grammar.

Definition at line 110 of file regex_constants.h.

Specifies that the grammar recognized by the regular expression engine is that used by POSIX utility grep when given the -E option in IEEE Std 1003.1-2001. This option is identical to syntax_option_type extended, except that newlines are treated as whitespace.

Definition at line 153 of file regex_constants.h.

Specifies that the grammar recognized by the regular expression engine is that used by POSIX extended regular expressions in IEEE Std 1003.1-2001, Portable Operating System Interface (POSIX), Base Definitions and Headers, Section 9, Regular Expressions.

Definition at line 127 of file regex_constants.h.

When a regular expression match is to be replaced by a new string, the new string is constructed using the rules used by the ECMAScript replace function in ECMA- 262 [Ecma International, ECMAScript Language Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11 String.prototype.replace. In addition, during search and replace operations all non-overlapping occurrences of the regular expression are located and replaced, and sections of the input that did not match the expression are copied unchanged to the output string.

Format strings (from ECMA-262 [15.5.4.11]):

  • $$ The dollar-sign itself ($)
  • $& The matched substring.
  • $` The portion of string that precedes the matched substring. This would be match_results::prefix().
  • $' The portion of string that follows the matched substring. This would be match_results::suffix().
  • $n The nth capture, where n is in [1,9] and $n is not followed by a decimal digit. If n <= match_results::size() and the nth capture is undefined, use the empty string instead. If n > match_results::size(), the result is implementation-defined.
  • $nn The nnth capture, where nn is a two-digit decimal number on [01, 99]. If nn <= match_results::size() and the nth capture is undefined, use the empty string instead. If nn > match_results::size(), the result is implementation-defined.

Definition at line 273 of file regex_constants.h.

When specified during a search and replace operation, only the first occurrence of the regular expression shall be replaced.

Definition at line 294 of file regex_constants.h.

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.

Definition at line 288 of file regex_constants.h.

When a regular expression match is to be replaced by a new string, the new string is constructed using the rules used by the POSIX sed utility in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].

Definition at line 281 of file regex_constants.h.

Specifies that the grammar recognized by the regular expression engine is that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is identical to syntax_option_type basic, except that newlines are treated as whitespace.

Definition at line 145 of file regex_constants.h.

Specifies that the matching of regular expressions against a character sequence shall be performed without regard to case.

Definition at line 79 of file regex_constants.h.

If more than one match is possible then any match is an acceptable result.

Definition at line 228 of file regex_constants.h.

The expression only matches a sub-sequence that begins at first .

Definition at line 238 of file regex_constants.h.

The default matching rules.

Definition at line 196 of file regex_constants.h.

The first character in the sequence [first, last) is treated as though it is not at the beginning of a line, so the character (^) in the regular expression shall not match [first, first).

Definition at line 203 of file regex_constants.h.

The expression \b is not matched against the sub-sequence [first,first).

Definition at line 216 of file regex_constants.h.

The last character in the sequence [first, last) is treated as though it is not at the end of a line, so the character ($) in the regular expression shall not match [last, last).

Definition at line 210 of file regex_constants.h.

The expression \b should not be matched against the sub-sequence [last,last).

Definition at line 222 of file regex_constants.h.

The expression does not match an empty sequence.

Definition at line 233 of file regex_constants.h.

--first is a valid iterator position. When this flag is set then the flags match_not_bol and match_not_bow are ignored by the regular expression algorithms 28.11 and iterators 28.12.

Definition at line 245 of file regex_constants.h.

Specifies that when a regular expression is matched against a character container sequence, no sub-expression matches are to be stored in the supplied match_results structure.

Definition at line 86 of file regex_constants.h.

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.

Definition at line 94 of file regex_constants.h.