C++ 参考手册
- C++11
- C++14
- C++17
- C++20
- C++ 编译器支持情况表
- 独立与宿主实现
- C++ 语言
- C++ 关键词
- 预处理器
- C++ 标准库头文件
- 具名要求
- 功能特性测试 (C++20)
- 工具库
- 类型支持(基本类型、RTTI、类型特性)
- 概念库 (C++20)
- 错误处理
- 动态内存管理
- 日期和时间工具
- 字符串库
- 容器库
- 迭代器库
- 范围库 (C++20)
- 算法库
- 数值库
- 输入/输出库
- 文件系统库
- 本地化库
- 正则表达式库
- std::basic_regex
- std::basic_regex<CharT,Traits>::basic_regex
- std::basic_regex<CharT,Traits>::~basic_regex
- std::basic_regex<CharT,Traits>::operator=
- std::basic_regex<CharT,Traits>::assign
- std::basic_regex<CharT,Traits>::mark_count
- std::basic_regex<CharT,Traits>::flags
- std::basic_regex<CharT,Traits>::getloc
- std::basic_regex<CharT,Traits>::imbue
- std::basic_regex<CharT,Traits>::swap
- std::basic_regex 常量
- std::swap(std::basic_regex)
- std::basic_regex 的推导指引
- std::sub_match
- std::match_results
- std::regex_search
- std::regex_replace
- std::regex_iterator
- std::regex_match
- std::regex_token_iterator
- std::regex_error
- std::regex_traits
- std::regex_constants::syntax_option_type
- std::regex_constants::match_flag_type
- std::regex_constants::error_type
- 改 ECMAScript 正则表达式文法
- 注释
- 原子操作库
- 线程支持库
- 实验性 C++ 特性
- 有用的资源
- 索引
- std 符号索引
- 协程支持 (C++20)
- C++ 关键词
位置:首页 > C++ 参考手册 >正则表达式库 >std::basic_regex > std::basic_regex<CharT,Traits>::basic_regex
std::basic_regex<CharT,Traits>::basic_regex
| basic_regex(); | (1) | (C++11 起) | 
| explicit basic_regex( const CharT* s,  flag_type f = std::regex_constants::ECMAScript ); | (2) | (C++11 起) | 
| basic_regex( const CharT* s, std::size_t count, flag_type f = std::regex_constants::ECMAScript ); | (3) | (C++11 起) | 
| basic_regex( const basic_regex& other ); | (4) | (C++11 起) | 
| basic_regex( basic_regex&& other ) noexcept; | (5) | (C++11 起) | 
| template< class ST, class SA > explicit basic_regex( const std::basic_string<CharT,ST,SA>& str,  | (6) | (C++11 起) | 
| template< class ForwardIt > basic_regex( ForwardIt first, ForwardIt last,  | (7) | (C++11 起) | 
| basic_regex( std::initializer_list<CharT> init,  flag_type f = std::regex_constants::ECMAScript ); | (8) | (C++11 起) | 
从按照标志 f 转译的字符序列构造新的正则表达式。
1) 默认构造函数。构造将不匹配内容的空正则表达式。
2) 从空终止字符串 
s 构造正则表达式。3) 从 
s 所指向的 count 个的字符序列构造正则表达式。4) 复制构造函数。通过复制 
other 构造正则表达式。5) 移动构造函数。用移动语义构造拥有 
other 内容的正则表达式。6) 从 string 
str 构造正则表达式。7) 范围构造函数。构造拥有范围 
[first, last) 内容的正则表达式。8) initializer_list 构造函数。构造拥有 initializer_list 
init 内容的正则表达式。参数
| s | - | 指向空终止字符串的指针 | 
| count | - | 用于初始化 regex 的字符序列长度 | 
| first, last | - | 用于初始化 regex 的字符序列范围 | 
| str | - | 用作源初始化 regex 的 basic_string | 
| other | - | 用作源初始化 regex 的另一 regex | 
| init | - | 用于初始化 regex 的 initializer_list | 
| f | - | 用于指引转译字符序列为正则表达式的标志 | 
| 类型要求 | ||
| - ForwardIt必须满足遗留向前迭代器 (LegacyForwardIterator)  的要求。 | ||
异常
1) (无)
2-3) 若提供的正则表达式非法则为 std::regex_error 。
4) (无)
6-8) 若提供的正则表达式非法则为 std::regex_error 。