I have the sentences "This is the best day of my life" and "Here are the best
day of my life"and "best day". I wish to match "best" followed by "day" using regex, i.e the sentence should contain the expression "best day".Note that there can be any number of spaces between "best" and "day", however, day should come after best.
I wrote this regex - (best)(\\s+)(day)
and used regex_match in C++ but it's not working. I'm not very familiar with Regex; could somebody guide me?
bool isValidBestDay(string str)
{
string bestDay = "(best)(\\s+)(day)";
regex bestDayMatch(suchThat, ECMAScript | icase);
return regex_match(str, bestDayMatch);
}
The problem I'm facing on C++ is that if I have a string 'best day' it matches, but not if I have something like "this best day". Thanks!