开发者

Can boost::regex_search be done on a wstring?

开发者 https://www.devze.com 2023-01-28 23:24 出处:网络
This is what I tried: std::wstring extractText(std::wstring line) { std::wstring text; bo开发者_运维技巧ost::regex exp(\"^.*?PRIVMSG #.*? :(.+)\");

This is what I tried:

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

    bo开发者_运维技巧ost::regex exp("^.*?PRIVMSG #.*? :(.+)");
    boost::smatch match;

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

    return text;
    }


use wregex and wsmatch


I believe so, but you'll need to use boost::wsmatch instead of smatch, and wregex as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消