std::regex_iterator<BidirIt,CharT,Traits>:: operator*,operator->
From cppreference.net
<
cpp
|
regex
|
regex iterator
C++
Text processing library
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Regular expressions library
| Classes | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Algorithms | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Iterators | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Exceptions | ||||
|
(C++11)
|
||||
| Traits | ||||
|
(C++11)
|
||||
| Constants | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Regex Grammar | ||||
|
(C++11)
|
std::regex_iterator
| Member functions | ||||
| Comparisons | ||||
|
(until C++20)
|
||||
| Observers | ||||
|
regex_iterator::operator*
regex_iterator::operator->
|
||||
| Modifiers | ||||
|
const
value_type
&
operator
*
(
)
const
;
|
(1) | (depuis C++11) |
|
const
value_type
*
operator
-
>
(
)
const
;
|
(2) | (depuis C++11) |
Extrait le
std::match_results
actuel d'un
regex_iterator
.
Valeur de retour
1)
Retourne une référence au
std::match_results
actuel.
2)
Retourne un pointeur vers le
std::match_results
actuel.
Exemple
Exécuter ce code
#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'; }
Sortie :
112334