std::match_results<BidirIt,Alloc>::prefix
From cppreference.com
< cpp | regex | match results
| const_reference prefix() const; |
(C++11以降) | |
正規表現の全体のマッチの開始位置から、ターゲットシーケンスの開始位置までの間の std::sub_match オブジェクトへの参照を取得します。
ready() は true でなければなりません。それ以外の場合、動作は未定義です。
[編集] 返り値
マッチしなかったプレフィックスへの参照。
[編集] 例
このコードを実行
#include <iostream> #include <regex> #include <string> int main() { std::regex re("a(a)*b"); std::string target("baaaby"); std::smatch sm; std::regex_search(target, sm, re); std::cout << sm.prefix().str() << '\n'; }
出力
b
[編集] 関連項目
| 全体のマッチの終了位置からターゲットシーケンスの終了位置までの間のサブシーケンスを返します。 (public member function) |