Scroll to navigation

std::regex_iterator::operator*,operator->(3) C++ Standard Libary std::regex_iterator::operator*,operator->(3)

NAME

std::regex_iterator::operator*,operator-> - std::regex_iterator::operator*,operator->

Synopsis


const value_type& operator*() const; (1) (since C++11)
const value_type* operator->() const; (2) (since C++11)


Extracts the current std::match_results from a regex_iterator:

Return value


1) Returns a reference to the current std::match_results.
2) Returns a pointer to the current std::match_results.

Example

// Run this code


#include <iostream>
#include <string>
#include <regex>


int main()
{
std::regex expression("[1234]");
std::string searchStr("1.1a2b3cjk34");


for (std::regex_iterator<std::string::iterator> it{
searchStr.begin(), searchStr.end(), expression
}, last{}; it != last; ++it) {
std::cout << it->str();
}
}

Output:


112334

2022.07.31 http://cppreference.com