match_results size() in C++ STL
The match_results size() is a inbuilt function in C++ which returns the number of matches ans sub-matches in the match_result object.
smatch_name.size() Note: smatch_name is an object of match_results class.
Parameters: The function accept no parameters.
Return value: It returns the number of matches in the match_result object.
Note: First element always contains the whole regex match while the others contain the particular Capturing Group
Below programs illustrate the above function.
match size is 3
match size is 3 match 0 has a length of 13 match 1 has a length of 5 match 2 has a length of 8