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
;
|
(seit C++11) | |
Ruft eine Referenz auf das std::sub_match -Objekt ab, das die Zielsequenz zwischen dem Beginn der Zielsequenz und dem Start des gesamten Übereinstimmung des regulären Ausdrucks darstellt.
ready()
muss
true
sein. Andernfalls ist das Verhalten undefiniert.
Rückgabewert
Verweis auf das nicht übereinstimmende Präfix.
Beispiel
Diesen Code ausführen
#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'; }
Ausgabe:
b
Siehe auch
|
gibt die Teilsequenz zwischen dem Ende der vollständigen Übereinstimmung und dem Ende der Zielsequenz zurück
(öffentliche Elementfunktion) |