Finally, we come to the difference of regex_match() and regex_search:
• regex_match() checks whether the whole character sequence matches a regular expression.
• regex_search() checks whether the character sequence partially matches a regular expression.
There is no other difference. Thus,
regex_search (data, regex(pattern))
is always equivalent to
regex_match (data, regex("(.|
)*"+pattern+"(.|
)*"))
where “(.|
)*” stands for any number of any character (“.” stands for any character except the newline character and “|” stands for “or”).
Now, you might say that these statements miss important information, at least for the function regex_search(): where a regular expression matches a given character sequence. For this and many more features, we have to introduce new versions of regex_match() and regex_search(), where a new parameter returns all necessary information about a match.