boost regex sub-string match

boost, c++, regex

Solution

The boost::regex_match only matches the whole string, you probably want boost::regex_search instead.

Problem

I want to return output "match" if the pattern "regular" is a sub-string of variable st. Is this possible? ``` int main() { string st = "some regular expressions are Regxyzr"; boost::regex ex("[Rr]egular"); if (boost::regex_match(st, ex)) { cout << "match" << endl; } else { cout << "not match" << endl; } } ```

Original source

Related problems