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 vaulue: It returns the number of matches in the match_result object.
Note: First element always contains the whole regex match while the others conatain 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
- map::size() in C++ STL
- set::size() in C++ STL
- unordered_multiset size() in C++ STL
- unordered_map size() in C++ STL
- array::size() in C++ STL
- bitset size() in C++ STL
- list size() function in C++ STL
- unordered_set size() function in C++ STL
- multimap size() function in C++ STL
- multiset size() in C++ STL with Examples
- unordered_multimap size() function in C++ STL
- Why is the size of an empty class not zero in C++?
- valarray size() function in C++
- C Program to find size of a File
- Size of array after repeated deletion of LIS
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.