Regex C++ : 正则表达式(2).
既然有了std::basic_regex存储我们的正则表达式了,那我们怎么匹配到的字符串呢? 重点强调 : 无论是std::regex_match还是std::regex_search都不能接受一个右值版本的std::basic_string!!!!! 下面我们将介绍: std::regex_search :检验是否部分字符串匹配给定的正则表达式. std::regex_match :检验是否整个字符串匹配给定的正则表达式. std::regex_search //first: 一个指向被匹配字符串开始位置的迭代器. //last: -个指向被匹配字符串结束位置的迭代器. //m: 存放匹配的结果. //e: 存放正则表达式. //flags: 指出使用哪种正则表达式的语法. template< class BidirIt, class Alloc, class CharT, class Traits > bool regex_search( BidirIt first, BidirIt last, std::match_results<BidirIt,Alloc>& m, const std::basic_regex<CharT,Traits>& e, std::regex_constants::match_flag_type flags = std::regex