65,211
社区成员
发帖
与我相关
我的任务
分享#include <string>
#include <iostream>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;
int main()
{
//直接replace会有公共前缀的问题
//两边加上空白符吧...还有\t之类没有写,只作示例
regex word_reg(" a | an | the | that | this | which | what | where | however");
string str ="this is an apple. where is the pig? that is it";
str = regex_replace(str, word_reg, "@");
cout << str << endl;
return 0;
}