很明显,这里必须匹配,但此代码仍会返回false。
#include <iostream>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;
int main() {
cout << regex_match("some text", regex("text")) << endl;
}
答案 0 :(得分:4)
regex_match
必须匹配所有给定的字符序列。请改为regex_search
。