std::match_results<BidirIt,Alloc>:: prefix
From cppreference.net
<
cpp
|
regex
|
match results
C++
Text processing library
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Regular expressions library
| Classes | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Algorithms | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Iterators | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Exceptions | ||||
|
(C++11)
|
||||
| Traits | ||||
|
(C++11)
|
||||
| Constants | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Regex Grammar | ||||
|
(C++11)
|
std::match_results
| Member functions | ||||
| State | ||||
| Element access | ||||
|
match_results::prefix
|
||||
| Iterators | ||||
| Format | ||||
| Modifiers | ||||
| Non-member functions | ||||
|
(until C++20)
|
||||
|
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
関連項目
|
完全一致の終端と対象シーケンスの終端の間の部分シーケンスを返す
(公開メンバ関数) |