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

时间:2010-12-06 22:15:10

标签: 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;
    }

2 个答案:

答案 0 :(得分:14)

使用wregex和wsmatch

答案 1 :(得分:2)

我相信,但您需要使用boost::wsmatch代替smatchwregex

相关问题