Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can boost::regex_search be done on a wstring?

Tags:

c++

regex

boost

This is what I tried:

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;
    }
like image 974
coolface Avatar asked Dec 06 '10 22:12

coolface


2 Answers

use wregex and wsmatch

like image 184
hillel Avatar answered Sep 17 '22 19:09

hillel


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

like image 39
bosmacs Avatar answered Sep 19 '22 19:09

bosmacs