«

C++ 使用regex正则表达式

benojan 发布于 阅读:843 c/c++


案例

#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");
}

正则表达式 regex