The match_results::operator= is used to replace all the matches in a smatch object with new matches from another smatch object.
smatch_name1 = (smatch_name2) Note: smatch_name is an object of match_results class.
Parameters: The smatch object on the right side gets copied to the one at the left side.
Return Value: It does not return anything.
Note: First element always contains the whole regex match while the others conatain the particular Capturing Group.
Below programs illustrate the above function.
Matches are: Geeksforgeeks Geeks forgeeks
Smatch with maximum matches: Geeksforgeeks Ge eks forgeeks
- Why overriding both the global new operator and the class-specific operator is not ambiguous?
- Operator Overloading '<<' and '>>' operator in a linked list class
- map operator= in C++ STL
- map::operator in C++ STL
- new vs operator new in C++
- set operator= in C++ STL
- dot (.) operator in C/C++
- unordered_set operator= in C++ STL
- match_results operator in C++ STL
- unordered_multimap operator= in C++
- unordered_map operator= in C++ STL
- forward_list::operator= in C++ STL
- multiset::operator= in C++ STL
- multimap::operator= in C++ STL
- bitset operator in C++ STL
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.