在线文档教程
C++
规律表达 | Regular expressions

std::basic_regex constants

性病:基本[医]正则常数

Defined in header
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;

std::basic_regex定义几个控制通用正则表达式匹配语法的常量。

这些常量是从std::regex_constants*

ValueEffect(s)
icaseCharacter matching should be performed without regard to case.
nosubsWhen performing matches, all marked sub-expressions (expr) are treated as non-marking sub-expressions (?:expr). No matches are stored in the supplied std::regex_match structure and mark_count() is zero
optimizeInstructs 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.
collateCharacter 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.
ECMAScriptUse the Modified ECMAScript regular expression grammar
basicUse the basic POSIX regular expression grammar (grammar documentation).
extendedUse the extended POSIX regular expression grammar (grammar documentation).
awkUse the regular expression grammar used by the awk utility in POSIX (grammar documentation)
grepUse the regular expression grammar used by the grep utility in POSIX. This is effectively the same as the basic option with the addition of newline '\n' as an alternation separator.
egrepUse the regular expression grammar used by the grep utility, with the -E option, in POSIX. This is effectively the same as the extended option with the addition of newline '\n' as an alternation separator in addtion to '|'.

最多只能选择一个语法选项。ECMAScript,,,basic,,,extended,,,awk,,,grep,,,egrep如果没有选择语法,ECMAScript被假定是被选中的。其他选项用作修饰符,例如std::regex("meow", std::regex::icase)等于std::regex("meow", std::regex::ECMAScript|std::regex::icase)...

另见

syntax_option_type (C++11)general options controlling regex behavior (typedef)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/regex/basic[医]正则/常数