std::match_results<BidirIt,Alloc>:: prefix
From ja.cppreference.net
<
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
関連項目
|
完全一致の終端と対象シーケンスの終端の間の部分シーケンスを返す
(公開メンバ関数) |