std::regex_constants:: match_flag_type
|
定义于头文件
<regex>
|
||
|
using
match_flag_type
=
/* 由实现定义 */
;
|
(1) | (C++11 起) |
|
constexpr
match_flag_type match_default
=
{
}
;
constexpr
match_flag_type match_not_bol
=
/* 未指定 */
;
|
(2) |
(C++11 起)
(C++17 起为内联) |
常量
注意:
[
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
常量是空位掩码。
缺陷报告
以下行为变更缺陷报告被追溯应用于先前发布的C++标准。
| 缺陷报告 | 适用范围 | 发布时的行为 | 正确行为 |
|---|---|---|---|
| LWG 2053 | C++11 |
1. 常量被声明为
static
2.
match_default
和
format_default
从
0
初始化
|
1. 移除
static
说明符
2. 从 { } 初始化 |
参见
|
(C++11)
|
尝试将正则表达式与整个字符序列进行匹配
(函数模板) |
|
(C++11)
|
控制正则表达式行为的通用选项
(类型定义) |
|
(C++11)
|
描述不同类型的匹配错误
(类型定义) |