首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::sub_match

Defined in header <regex>

template< class BidirIt > class sub_match;

(since C++11)

类模板sub_match正则表达式引擎用于表示标记子表达式匹配的字符序列。匹配就是[begin, end)在正则表达式匹配的目标范围内配对,但使用附加的观察者函数来提高代码的清晰度。

只有默认构造函数是可公开访问的。实例sub_match通常作为std::match_results容器在处理过程中的一种正则表达式算法。

成员函数返回定义的默认值,除非matched成员是true...

sub_match继承自std::pair<BidirIt, BidirIt>,虽然不能将其视为std::pair对象,因为交换和赋值等成员函数无法按预期工作。

类型要求

-Bidirit必须符合双向迭代器的要求。

*。

专门性

提供了几种常见字符序列类型的专门化:

在标头中定义<regex>

*。

类型定义

csub[医]匹配子[医]匹配<Const char%2A>

王氏[医]匹配子[医]匹配<Const wchar[医]T型%2A>

苏巴[医]匹配子[医]Match<std::string::const[医]迭代器>

Wssub[医]匹配子[医]Match<std::wstring::const[医]迭代器>

成员类型

Member type

Definition

iterator

BidirIt

value_type

std::iterator_traits<BidirIt>::value_type

difference_type

std::iterator_traits<BidirIt>::difference_type

string_type

std::basic_string<value_type>

成员对象

bool matched

Indicates if this match was successful (public member object)

继承自STD:一对

BidirIt first

Start of the match sequence. (public member object)

BidirIt second

One-past-the-end of the match sequence. (public member object)

成员函数

(constructor)

constructs the match object (public member function)

观察员

如果有任何%29%28公共成员函数%29,则返回匹配值%28的长度。

选通串[医]类型转换为基础字符串类型%28公共成员函数%29

比较匹配子序列%28如果有%29%28公共成员函数%29

非会员职能

operator==operator!=operator<operator<=operator>operator>=

compares two sub_match objects (function template)

operator<<

outputs the matched character subsequence (function template)

另见

regex_token_iterator (C++11)

iterates through regex submatches (class template)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券