C++正则匹配替换带""的字符串

#include <regex>    

#include <string>

#include <iostream>

#include<fstream>

using namespace std;

 

int main()

{

  

    string str="\"time\":2021-02-27,\"parament\":hello world,\"ip\":201.233.5.78,\"other\":ga21#";   

    regex repattern1("(?<=\"parament\":).*(?=,\"ip\")");

    smatch match1;

    string replace1="*";

    regex_match(str,match1,repattern1);

    cout<<boolalpha<<regex_match(str,repattern1)<<endl;

    cout<<match1[0]<<endl;

    cout<<regex_replace(str, repattern1, replace1)<<std::endl;

    system("pause");

    return 0;

}

这段代码匹配"time":2021-02-27,"parament":hello world,"ip":201.233.5.78,"other":ga21#中"parament":和,"ip"之间的内容,并将内容匹配为*,但是运行后直接就退出了,也没有替换成功,请问各位这是什么原因?

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^