std::regex_iterator<BidirIt,CharT,Traits>:: operator*,operator->
From ja.cppreference.net
<
cpp
|
regex
|
regex iterator
|
const
value_type
&
operator
*
(
)
const
;
|
(1) | (C++11以降) |
|
const
value_type
*
operator
-
>
(
)
const
;
|
(2) | (C++11以降) |
現在の
std::match_results
を
regex_iterator
から抽出します。
戻り値
1)
現在の
std::match_results
への参照を返します。
2)
現在の
std::match_results
へのポインタを返します。
例
このコードを実行
#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'; }
出力:
112334