Boost C++ 库

...世界上最受尊敬和专业设计的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu, C++ 编码标准

PrevUpHomeNext

函数 regex_match

boost::xpressive::regex_match — 检查正则表达式是否从头到尾匹配序列。

概要

// In header: <boost/xpressive/regex_algorithms.hpp>


template<typename BidiIter> 
  bool regex_match(BidiIter begin, BidiIter end, 
                   match_results< BidiIter > & what, 
                   basic_regex< BidiIter > const & re, 
                   regex_constants::match_flag_type flags = regex_constants::match_default);
template<typename BidiIter> 
  bool regex_match(BidiIter begin, BidiIter end, 
                   basic_regex< BidiIter > const & re, 
                   regex_constants::match_flag_type flags = regex_constants::match_default);
template<typename Char> 
  bool regex_match(Char * begin, match_results< Char * > & what, 
                   basic_regex< Char * > const & re, 
                   regex_constants::match_flag_type flags = regex_constants::match_default);
template<typename BidiRange, typename BidiIter> 
  bool regex_match(BidiRange & rng, match_results< BidiIter > & what, 
                   basic_regex< BidiIter > const & re, 
                   regex_constants::match_flag_type flags = regex_constants::match_default, 
                   unspecified = 0);
template<typename BidiRange, typename BidiIter> 
  bool regex_match(BidiRange const & rng, match_results< BidiIter > & what, 
                   basic_regex< BidiIter > const & re, 
                   regex_constants::match_flag_type flags = regex_constants::match_default, 
                   unspecified = 0);
template<typename Char> 
  bool regex_match(Char * begin, basic_regex< Char * > const & re, 
                   regex_constants::match_flag_type flags = regex_constants::match_default);
template<typename BidiRange, typename BidiIter> 
  bool regex_match(BidiRange & rng, basic_regex< BidiIter > const & re, 
                   regex_constants::match_flag_type flags = regex_constants::match_default, 
                   unspecified = 0);
template<typename BidiRange, typename BidiIter> 
  bool regex_match(BidiRange const & rng, basic_regex< BidiIter > const & re, 
                   regex_constants::match_flag_type flags = regex_constants::match_default, 
                   unspecified = 0);

描述

确定正则表达式 re 是否与序列 [begin, end) 的全部内容完全匹配。

参数

begin

序列的起始位置。

end

序列的结束位置。

what

将子匹配项写入的 match_results 结构体。

re

要使用的正则表达式对象。

flags

可选的匹配标志,用于控制表达式与序列的匹配方式。(请参见 match_flag_type。)

要求

类型 BidiIter 满足双向迭代器的要求 (24.1.4)。

要求

[begin,end) 表示一个有效的迭代器范围。

返回值

如果找到匹配项,则返回 true,否则返回 false

抛出

regex_error 在堆栈耗尽时

PrevUpHomeNext