user3080539
user3080539

Reputation: 1

Using regex_search

I'm trying to parse some text to figure out if it's a link or not. This is the code I have:

    smatch m;
    regex e("http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+");
    bool match = regex_search(proto->message, m, e);
    if(match == true) {
        chan->Say("Matched link");
    }

The error I'm getting is:

/main.cpp|26|error: no matching function for call to ‘regex_search(char [1024], boost::smatch&, boost::regex&)’|

When I take the m out of regex_search it works and returns a boolean, but I want know what the actual match was.

Upvotes: 0

Views: 108

Answers (1)

denarced
denarced

Reputation: 362

Boost's regex_search does not define such a signature that you're trying to use. In none of the overloads is boost::smatch the second parameter. In fact, smatch isn't used at all. See docs and in particular the example at the bottom of the page.

Upvotes: 1

Related Questions