Search⌘ K
AI Features

The Search Result

Explore how to use std::match_results and std::smatch objects in C++ to handle regex search results. Understand capture groups and their methods for detailed pattern matching and text manipulation.

We'll cover the following...

The object of type std::match_results is the result of a std::regex_match or std::regex_search. std::match_results is a sequential container having at least one capture group of a std::sub_match object. The std::sub_match objects are sequences of characters.

ℹ️ What is a capture group?
Capture groups allow it to further analyse the search result in a regular expression. They are defined by a pair of parentheses (). The regular expression ((a+)(b+)(c+)) has four capture groups: ((a+)(b+)(c+)), (a+), (b+) and (c+) The total result is the 0th ...