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
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Why overriding both the global new operator and the class-specific operator is not ambiguous?
- Operator Overloading '<<' and '>>' operator in a linked list class
- dot (.) operator in C/C++
- set operator= in C++ STL
- map::operator in C++ STL
- new vs operator new in C++
- map operator= in C++ STL
- unordered_multiset operator = in C++ STL
- alignof operator in C++
- bitset operator in C++ STL
- array::operator[ ] in C++ STL
- multiset::operator= in C++ STL
- multimap::operator= in C++ STL
- list::operator= in C++ STL
- forward_list::operator= in C++ STL