I was experimenting with regular expression in trying to make an answer to this question, and found that while regex_match finds a match, regex_search
Assuming that C++ and Boost Regex have a similar structure and functionality, the difference between regex_match and regex_search is explained here:
The
regex_match()algorithm will only report success if the regex matches the whole input, from beginning to end. If the regex matches only a part of the input,regex_match()will return false. If you want to search through the string looking for sub-strings that the regex matches, use theregex_search()algorithm.