std::regex_constants::match_flag_type
在標頭檔案 <regex> 中定義 |
||
using match_flag_type = /* implementation-defined */; |
(1) | (C++11 起) |
constexpr match_flag_type match_default = {}; constexpr match_flag_type match_not_bol = /* unspecified */; |
(2) | (C++11 起) (C++17 起為 inline) |
[edit] 常量
注意:[
first,
last)
指的是正在匹配的字元序列。
名稱 | 解釋 |
match_not_bol
|
[ first, last) 中的第一個字元將被視為不在行首(即 ^ 不會匹配 [ first, first) )。 |
match_not_eol
|
[ first, last) 中的最後一個字元將被視為不在行尾(即 $ 不會匹配 [ last, last) )。 |
match_not_bow
|
\b 不會匹配 [ first, first) 。 |
match_not_eow
|
\b 不會匹配 [ last, last) 。 |
match_any
|
如果可能存在多個匹配項,則任何一個匹配項都是可接受的結果。 |
match_not_null
|
不匹配空序列。 |
match_continuous
|
只匹配始於 first 的子序列。 |
match_prev_avail
|
--first 是一個有效的迭代器位置。 設定時,會導致 match_not_bol 和 match_not_bow 被忽略。 |
format_default
|
在 std::regex_replace 中使用 ECMAScript 規則構造字串(語法文件)。 |
format_sed
|
在 std::regex_replace 中使用 POSIX sed 工具規則(語法文件)。 |
format_no_copy
|
在 std::regex_replace 中不將未匹配的字串複製到輸出。 |
format_first_only
|
在 std::regex_replace 中只替換第一個匹配項。 |
除 match_default
和 format_default
外,所有常量都是位掩碼元素。match_default
和 format_default
常量是空位掩碼。
[edit] 缺陷報告
下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。
缺陷報告 | 應用於 | 釋出時的行為 | 正確的行為 |
---|---|---|---|
LWG 2053 | C++11 | 1. 常量被宣告為 static 2. match_default 和 format_default 從 0 初始化 |
1. 移除了 static 指定符 2. 從 {} 初始化 |
[edit] 參閱
(C++11) |
嘗試將正則表示式與整個字元序列匹配 (函式模板) |
(C++11) |
控制正則表示式行為的通用選項 (typedef) |
(C++11) |
描述不同型別的匹配錯誤 (typedef) |