可以在wstring上完成boost :: regex_search吗?

coo*_*ace 7 c++ regex boost

这是我试过的:

std::wstring extractText(std::wstring line) {
    std::wstring text;

    boost::regex exp("^.*?PRIVMSG #.*? :(.+)");
    boost::smatch match;

    if (boost::regex_search(line, match, exp)) {
              text = std::wstring(match[1].first, match[1].second);
             }

    return text;
    }
Run Code Online (Sandbox Code Playgroud)

hil*_*lel 14

使用wregex和wsmatch