gpt4 book ai didi

c++ - 正则表达式 : C++ extract text within double quotes

转载 作者:行者123 更新时间:2023-11-30 04:20:45 24 4
gpt4 key购买 nike

我只想提取双引号内的那些词。所以,如果内容是:

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com