命名空间
变体
操作

std::match_results<BidirIt,Alloc>::suffix

来自 cppreference.cn
 
 
 
正则表达式库
(C++11)
算法
迭代器
异常
特性
常量
(C++11)
正则表达式语法
 
 
const_reference suffix() const;
(C++11 起)

获取对 std::sub_match 对象的引用,该对象表示正则表达式的整个匹配结束与目标序列结束之间的目标序列。

ready() 必须为 true。否则,行为未定义。

目录

[编辑] 参数

(无)

[编辑] 返回值

对未匹配后缀的引用。

[编辑] 示例

#include <iostream>
#include <regex>
#include <string>
 
int main()
{
    std::regex re("a(a)*by");
    std::string target("baaaby123");
    std::smatch sm;
 
    std::regex_search(target, sm, re);
    std::cout << sm.suffix() << '\n';
}

输出

123

[编辑] 参阅

返回目标序列的开头与完整匹配的开头之间的子序列
(public member function) [编辑]