std::regex_iterator<BidirIt,CharT,Traits>::operator*,operator->
提供: cppreference.com
< 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 を指すポインタを返します。
[編集]例
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();}}
出力:
112334