为什么boost :: regex_match总是让我回复?

时间:2013-01-29 22:25:00

标签: regex boost

很明显,这里必须匹配,但此代码仍会返回false。

#include <iostream>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;

int main() {
  cout << regex_match("some text", regex("text")) << endl;
}

1 个答案:

答案 0 :(得分:4)

regex_match必须匹配所有给定的字符序列。请改为regex_search