std::basic_regex
来自cppreference.com
|
|
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
| 在头文件 <regex> 中定义
|
||
| template < class CharT = char, |
(since C++11) | |
类模板
basic_regex提供了持有正则表达式的通用框架。 原文:
The class template
basic_regex provides a general framework for holding regular expressions. 提供了一些常用字符的特化:
原文:
Several specializations for common character types are provided:
| 在头文件
<regex> 中定义 | |
| 类型
|
定义 |
regex
|
basic_regex<char> |
wregex
|
basic_regex<wchar_t> |
目录 |
[编辑] 成员类型
| 成员类型
|
定义 |
value_type
|
CharT |
traits_type
|
Traits |
string_type
|
Traits::string_type |
locale_type
|
Traits::locale_type |
flag_type
|
std::regex_constants::syntax_option_type |
[编辑] 成员函数
| 构造正则表达式对象 (公共成员函数) | |
| 析构正则表达式对象 (公共成员函数) | |
| 为内容赋值 (公共成员函数) | |
| 分配的内容 (公共成员函数) | |
| |
| 返回标记的子表达式的数量 原文: returns the number of marked sub-expressions within the regular expression (公共成员函数) | |
| 返回语法标记 (公共成员函数) | |
| |
| 获得区域信息 (公共成员函数) | |
| 设置区域信息 (公共成员函数) | |
| |
| 交换内容 (公共成员函数) | |
| |
| 值
|
效果 |
| icase | 匹配字符时忽略大小写
原文: ignores case when matching characters |
| nosubs | 不存储子表达式匹配
原文: does not store sub-expression matches |
| optimize | 更快的匹配,但具有更慢的构造速度
原文: faster matching, slower construction |
| collate | 区域敏感的正则表达式
原文: makes range expressions locale-sensitive |
| ECMAScript | 使用ECMA-262(Perl 5中)语法
|
| basic | 使用了POSIX基本正则表达式语法
原文: uses a POSIX basic regular expression syntax |
| extended | 使用了POSIX扩展正则表达式语法
原文: uses a POSIX extended regular expression syntax |
| awk | 使用“awk”兼容的语法
|
| grep | 使用“grep”兼容的语法
|
| egrep | 使用“grep扩展”兼容的语法
原文: uses an extended grep-compatible syntax |
[编辑] 非成员函数
| (C++11) |
特化的std::swap算法 (函数模板) |