在re2 标题中它说
// C++ interface to the re2 regular-expression library.
// RE2 supports Perl-style regular expressions (with extensions like
// \d, \w, \s, ...).
我注意到我的模式失败然后注意到 \w 似乎不起作用。这是我的代码。为什么它不起作用?
#include <re2/re2.h>
#include <iostream>
int main(){
RE2::Arg s, i;
std::string sz("a or b");
RE2::Replace(&sz, "\w", "!");
std::cout << sz << std::endl;
}