If you call regex_match() instead of regex_search(), the match_results interface is the same. However, because regex_match() always matches the whole character sequence, prefix and suffix will always be empty.
Now we have all the information we need to find all matches of a regular expression, as the following program demonstrates: