std::regex_iterator<BidirIt,CharT,Traits>::operator*,operator-> - cppreference.com

From cppreference.com

constvalue_type&operator*()const; (1) (since C++11)constvalue_type*operator->()const; (2) (since C++11)Extracts the current

std::match_results

from a regex_iterator.

Return value

Example

Run this code

#include<iostream>#include<regex>#include<string>intmain(){std::stringhay{"1.1a2b3cjk34"};std::regexneedle("[1234]");usingRi=std::regex_iterator<std::string::iterator>;for(Riit{hay.begin(),hay.end(),needle},last{};it!=last;++it)std::cout<<it->str();std::cout<<'\n';}Output:

112334