std::basic_regexconstants(3)
π NAME π
std::basic_regexconstants β std::basic_regexconstants (yes bestie, same name twice, it's giving self-titled album energy πΏ). This is the constants page for std::basic_regex, and it's lowkey iconic.
β¨ Synopsis β¨
Okay so this is the whole constants situation, no cap:
Defined in header <regex>
static constexpr std::regex_constants::syntax_option_type icase =
std::regex_constants::icase;
static constexpr std::regex_constants::syntax_option_type nosubs =
std::regex_constants::nosubs;
static constexpr std::regex_constants::syntax_option_type optimize =
std::regex_constants::optimize;
static constexpr std::regex_constants::syntax_option_type collate =
std::regex_constants::collate;
static constexpr std::regex_constants::syntax_option_type ECMAScript
=
std::regex_constants::ECMAScript;
static constexpr std::regex_constants::syntax_option_type basic =
std::regex_constants::basic;
static constexpr std::regex_constants::syntax_option_type extended =
std::regex_constants::extended;
static constexpr std::regex_constants::syntax_option_type awk =
std::regex_constants::awk;
static constexpr std::regex_constants::syntax_option_type grep =
std::regex_constants::grep;
static constexpr std::regex_constants::syntax_option_type egrep =
std::regex_constants::egrep;
static constexpr std::regex_constants::syntax_option_type multiline =
(since C++17)
std::regex_constants::multiline;
std::basic_regex defines several constants that govern general regex matching syntax. These constants are duplicated from std::regex_constants, bestie β they're literally the same vibes.
π Grammar option energy π
ECMAScriptβ Use the Modified 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 theawkutility in POSIX (grammar documentation).grepβ Use the regular expression grammar used by thegreputility in POSIX. This is effectively the same as thebasicoption with the addition of newline'\n'as an alternation separator.egrepβ Use the regular expression grammar used by thegreputility, with the-Eoption, in POSIX. This is effectively the same as theextendedoption with the addition of newline'\n'as an alternation separator in addition to'|'.
π Grammar variation energy π
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_matchstructure 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,ECMAScriptis 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).
π¦ See also π¦
syntax_option_typeβ general options controlling regex behavior (C++11) (typedef)
source + version + date combo, for the record: http://cppreference.com Β· 2024.06.10 Β· std::basic_regexconstants(3) β mwah, slay, go regex responsibly bestie πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms