我只想提取双引号内的单词。所以,如果内容是:
Would "you" like to have responses to your "questions" sent to you via email?
答案一定是
1-你 2-问题
最佳答案
std::string str("test \"me too\" and \"I\" did it");
std::regex rgx("\"([^\"]*)\""); // will capture "me too"
std::regex_iterator current(str.begin(), str.end(), rgx);
std::regex_iterator end;
while (current != end)
std::cout << *current++;
关于c++ - 正则表达式 : C++ extract text within double quotes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15039421/