C++ 使用regex正则表达式
案例
#include <iostream>
#include <regex>
using namespace std;
int main()
{
string str{ "ang1\tm1-n1-ng1 ang1" };
regex e{ "(^|[ \\-\\s])([mn])(g*)1" };
cout << regex_replace(str, e, "$1$2$3");
}
#include <iostream>
#include <regex>
using namespace std;
int main()
{
string str{ "ang1\tm1-n1-ng1 ang1" };
regex e{ "(^|[ \\-\\s])([mn])(g*)1" };
cout << regex_replace(str, e, "$1$2$3");
}