| Localization library | |||||||||||||||||||||||||
| Regular expressions library(C++11) | |||||||||||||||||||||||||
| Formatting library(C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Classes | ||||
basic_regex (C++11) | ||||
(C++11) | ||||
(C++11) | ||||
| Algorithms | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
| Iterators | ||||
(C++11) | ||||
(C++11) | ||||
| Exceptions | ||||
(C++11) | ||||
| Traits | ||||
(C++11) | ||||
| Constants | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
| Regex Grammar | ||||
(C++11) |
| Member Functions | ||||
| Observers | ||||
| Locale | ||||
| Modifiers | ||||
| Constants | ||||
| Non-member Functions | ||||
| Deduction guides(C++17) |
Defined in header <regex> | ||
template< class CharT, | (since C++11) | |
The class templatebasic_regex provides a general framework for holding regular expressions.
Several typedefs for common character types are provided:
Defined in header <regex> | |
| Type | Definition |
std::regex | std::basic_regex<char> |
std::wregex | std::basic_regex<wchar_t> |
Contents |
| Member type | Definition |
value_type | CharT |
traits_type | Traits |
string_type | Traits::string_type |
locale_type | Traits::locale_type |
flag_type | std::regex_constants::syntax_option_type |
| constructs the regex object (public member function)[edit] | |
| destructs the regex object (public member function)[edit] | |
| assigns the contents (public member function)[edit] | |
| assigns the contents (public member function)[edit] | |
Observers | |
| returns the number of marked sub-expressions within the regular expression (public member function)[edit] | |
| returns the syntax flags (public member function)[edit] | |
Locale | |
| get locale information (public member function)[edit] | |
| set locale information (public member function)[edit] | |
Modifiers | |
| swaps the contents (public member function)[edit] | |
Constants | |
| Grammar option | Effect(s) |
ECMAScript | Use theModified ECMAScript regular expression grammar. |
basic | Use the basic POSIX regular expression grammar (grammar documentation). |
extended | Use the extended POSIX regular expression grammar (grammar documentation). |
awk | Use the regular expression grammar used by theawk utility in POSIX (grammar documentation). |
grep | Use the regular expression grammar used by thegrep utility in POSIX. This is effectively the same as thebasic option with the addition of newline'\n' as an alternation separator. |
egrep | Use the regular expression grammar used by thegrep utility, with the-E option, in POSIX. This is effectively the same as theextended option with the addition of newline'\n' as an alternation separator in addition to'|'. |
| Grammar variation | Effect(s) |
icase | Character matching should be performed without regard to case. |
nosubs | When performing matches, all marked sub-expressions(expr) are treated as non-marking sub-expressions(?:expr). No matches are stored in the suppliedstd::regex_match structure andmark_count() is zero. |
optimize | Instructs the regular expression engine to make matching faster, with the potential cost of making construction slower. For example, this might mean converting a non-deterministic FSA to a deterministic FSA. |
collate | Character ranges of the form"[a-b]" will be locale sensitive. |
multiline(C++17) | Specifies that^ shall match the beginning of a line and$ shall match the end of a line, if the ECMAScript engine is selected. |
At most one grammar option can be chosen out ofECMAScript,basic,extended,awk,grep,egrep. If no grammar is chosen,ECMAScript is assumed to be selected. The other options serve as variations, such thatstd::regex("meow", std::regex::icase) is equivalent tostd::regex("meow", std::regex::ECMAScript|std::regex::icase).
The member constants inbasic_regex are duplicates of thesyntax_option_type constants defined in the namespacestd::regex_constants.
(C++11) | specializes thestd::swap algorithm (function template)[edit] |