Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::basic_regex constants

      From cppreference.com
      <cpp‎ |regex‎ |basic regex
       
       
       
      Regular expressions library
      Classes
      (C++11)
      Algorithms
      Iterators
      Exceptions
      Traits
      Constants
      (C++11)
      Regex Grammar
       
       
      Defined in header<regex>
      staticconstexprstd::regex_constants::syntax_option_type icase=

         std::regex_constants::icase;
      staticconstexprstd::regex_constants::syntax_option_type nosubs=
         std::regex_constants::nosubs;
      staticconstexprstd::regex_constants::syntax_option_type optimize=
         std::regex_constants::optimize;
      staticconstexprstd::regex_constants::syntax_option_type collate=
         std::regex_constants::collate;
      staticconstexprstd::regex_constants::syntax_option_type ECMAScript=
         std::regex_constants::ECMAScript;
      staticconstexprstd::regex_constants::syntax_option_type basic=
         std::regex_constants::basic;
      staticconstexprstd::regex_constants::syntax_option_type extended=
         std::regex_constants::extended;
      staticconstexprstd::regex_constants::syntax_option_type awk=
         std::regex_constants::awk;
      staticconstexprstd::regex_constants::syntax_option_type grep=
         std::regex_constants::grep;
      staticconstexprstd::regex_constants::syntax_option_type egrep=

         std::regex_constants::egrep;
      (since C++17)

      std::basic_regex defines several constants that govern general regex matching syntax.

      These constants are duplicated fromstd::regex_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).

      [edit]See also

      general options controlling regex behavior
      (typedef)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/regex/basic_regex/constants&oldid=160998"

      [8]ページ先頭

      ©2009-2025 Movatter.jp