#include <iostream>
#include <regex>
using namespace std;
int main() {
string text = "\/*comment 1*\/text1\n\/*comment 2*\/text2\n";
string pattern = "([\\s\\S]*?)((?:\/\\*[\\s\\S]+?\\*\/)|$)";
regex re(pattern);
cout << "pattern: " << pattern << endl;
cout << regex_replace(text,re,"$2");
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8cmVnZXg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CiAgIHN0cmluZyB0ZXh0ID0gIlwvKmNvbW1lbnQgMSpcL3RleHQxXG5cLypjb21tZW50IDIqXC90ZXh0MlxuIjsKICAgc3RyaW5nIHBhdHRlcm4gPSAiKFtcXHNcXFNdKj8pKCg/OlwvXFwqW1xcc1xcU10rP1xcKlwvKXwkKSI7CiAgIHJlZ2V4IHJlKHBhdHRlcm4pOwogICBjb3V0IDw8ICJwYXR0ZXJuOiAiIDw8IHBhdHRlcm4gPDwgZW5kbDsKICAgY291dCA8PCByZWdleF9yZXBsYWNlKHRleHQscmUsIiQyIik7CiAgIHJldHVybiAwOwp9