Difference between regex_match and 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 the regex_search() algorithm.

Leave a Comment