std::match_results<BidirIt,Alloc>::prefix
提供: cppreference.com
<tbody>
</tbody>
const_reference prefix() const; |
(C++11以上) | |
ターゲットシーケンスの先頭と正規表現のマッチ全体の先頭の間のターゲットシーケンスを表す std::sub_match オブジェクトを指す参照を取得します。
ready() == true でなければ動作は未定義です。
引数
(なし)
戻り値
マッチしなかった接頭辞を指す参照。
例
Run this code
#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