<regex>

定义模板类分析TR1 Regular Expressions,和多个模板类和函数,可在搜索文本的正则表达式对象的匹配项。

#include <regex>

备注

若要创建一个正则表达式对象,使用模板类basic_regex Class或其专用化, regex Typedefwregex Typedef语法标记类型的同时, regex_constants::syntax_option_type

要搜索文本匹配正则表达式对象,请使用的模板函数regex_match Functionregex_search Function匹配标记类型的同时, regex_constants::match_flag_type。这些函数返回的结果使用的模板类match_results Class和其专用化, cmatch Typedefwcmatch Typedefsmatch Typedef,和wsmatch Typedef模板类同时, sub_match Class和其专用化, csub_match Typedefwcsub_match Typedefssub_match Typedef,和wssub_match Typedef

要替换的文本相匹配的正则表达式对象,请使用模板函数regex_replace Function匹配标记类型的同时, regex_constants::match_flag_type

若要循环访问多个匹配的正则表达式对象,使用的模板类regex_iterator Classregex_token_iterator Class或其专用化, cregex_iterator Typedefsregex_iterator Typedefwcregex_iterator Typedefwsregex_iterator Typedefcregex_token_iterator Typedefsregex_token_iterator Typedefwcregex_token_iterator Typedef,或wsregex_token_iterator Typedef匹配标记类型的同时, regex_constants::match_flag_type

要修改的正则表达式语法的详细信息,请编写实现正则表达式具有相同特性的类。

Bb982382.collapse_all(zh-cn,VS.110).gif

basic_regex

换行的正则表达式。

match_results

包含一个子匹配项的序列。

regex_constants

包含各种类型的常量。

regex_error

报告错误的正则表达式。

regex_iterator

循环访问匹配结果。

regex_traits

描述用于匹配的元素的特征。

regex_traits <char>

描述特征的char进行匹配。

regex_traits <wchar_t>

描述特征的wchar_t进行匹配。

regex_token_iterator

循环访问子匹配项。

sub_match

描述子匹配项。

Bb982382.collapse_all(zh-cn,VS.110).gif类型定义

cmatch

键入用于定义charmatch_results

cregex_iterator

键入用于定义charregex_iterator

cregex_token_iterator

键入用于定义charregex_token_iterator

csub_match

键入用于定义charsub_match

正则表达式

键入用于定义charbasic_regex

smatch

键入用于定义stringmatch_results

sregex_iterator

键入用于定义stringregex_iterator

sregex_token_iterator

键入用于定义stringregex_token_iterator

ssub_match

键入用于定义stringsub_match

wcmatch

键入用于定义wchar_tmatch_results

wcregex_iterator

键入用于定义wchar_tregex_iterator

wcregex_token_iterator

键入用于定义wchar_tregex_token_iterator

wcsub_match

键入用于定义wchar_tsub_match

wregex

键入用于定义wchar_tbasic_regex

wsmatch

键入用于定义wstringmatch_results

wsregex_iterator

键入用于定义wstringregex_iterator

wsregex_token_iterator

键入用于定义wstringregex_token_iterator

wssub_match

键入用于定义wstringsub_match

Bb982382.collapse_all(zh-cn,VS.110).gif函数

regex_match

与完全匹配的正则表达式。

regex_replace

替换匹配正则表达式。

regex_search

正则表达式匹配搜索。

换用

Swaps basic_regex or match_results objects.

Bb982382.collapse_all(zh-cn,VS.110).gif运算符

运算符 = =

相等的各种对象进行比较。

运算符! =

各种对象不等于比较。

运算符 <

比较各种不同的对象内。

运算符 < =

各种对象小于或等于比较。

运算符 >

大于的各种对象进行比较。

运算符 > =

各种对象大于或等于比较。

运算符 <<

插入sub_match在流中。

请参见

概念

TR1 Regular Expressions

其他资源

regex 成员