Namespaces
Variants

std:: basic_regex constants

From cppreference.net
Regular expressions library
Classes
(C++11)
Algorithms
Iterators
Exceptions
Traits
Constants
(C++11)
Regex Grammar
定義済みヘッダー <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 ;
(C++17以降)

std::basic_regex は、正規表現マッチングの一般的な構文を制御するいくつかの定数を定義します。

これらの定数は std :: regex_constants から複製されています:

文法オプション 効果
ECMAScript 修正ECMAScript正規表現文法 を使用します。
basic 基本POSIX正規表現文法を使用します( 文法ドキュメント )。
extended 拡張POSIX正規表現文法を使用します( 文法ドキュメント )。
awk POSIXの awk ユーティリティで使用される正規表現文法を使用します( 文法ドキュメント )。
grep POSIXの grep ユーティリティで使用される正規表現文法を使用します。これは実質的に basic オプションと同じですが、改行 ' \n ' が選択肢区切りとして追加されています。
egrep POSIXの grep ユーティリティで -E オプションを使用した場合の正規表現文法を使用します。これは実質的に extended オプションと同じですが、 '|' に加えて改行 ' \n ' も選択肢区切りとして追加されています。
文法バリエーション 効果
icase 大文字小文字を区別せずに文字マッチングを実行します。
nosubs マッチング実行時、すべてのマークされた部分式 ( expr ) は非マーク部分式 (?: expr ) として扱われます。提供された std::regex_match 構造体にはマッチが保存されず、 mark_count() はゼロになります。
optimize 正規表現エンジンに対し、構築を遅くする可能性がある代償を払ってマッチングを高速化するよう指示します。例えば、非決定性FSAを決定性FSAに変換することが含まれます。
collate "[a-b]" 形式の文字範囲がロケール依存になります。
multiline (C++17) ECMAScriptエンジンが選択されている場合、 ^ が行の先頭にマッチし、 $ が行の末尾にマッチすることを指定します。

文法オプションは ECMAScript basic extended awk grep egrep の中から最大1つを選択できます。文法が選択されない場合、 ECMAScript が選択されているものと見なされます。他のオプションはバリエーションとして機能し、 std:: regex ( "meow" , std :: regex :: icase ) std:: regex ( "meow" , std :: regex :: ECMAScript | std :: regex :: icase ) と等価です。

関連項目

正規表現の動作を制御する一般オプション
(typedef)