Namespaces
Variants

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

From cppreference.net
Regular expressions library
Classes
(C++11)
Algorithms
Iterators
Exceptions
Traits
Constants
(C++11)
Regex Grammar
const value_type & operator * ( ) const ;
(1) (seit C++11)
const value_type * operator - > ( ) const ;
(2) (seit C++11)

Extrahiert den aktuellen std::match_results aus einem regex_iterator .

Rückgabewert

1) Gibt eine Referenz auf das aktuelle std::match_results zurück.
2) Gibt einen Zeiger auf die aktuellen std::match_results zurück.

Beispiel

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

Ausgabe:

112334