std::match_results::prefix(3)
π
std::match_results::prefix β a C++ Standard Libary moment π
π NAME π
std::match_results::prefix β std::match_results::prefix. That's the name, bestie, no notes β¨
β¨ Synopsis β¨
const_reference prefix() const; (since C++11)
Obtains a reference to the std::sub_match object representing the target sequence between the start of the beginning of the target sequence and the start of the entire match of the regular expression. Slay.
β οΈ warning: the behavior is undefined unlessready() == true. That means it's UB territory ifready() == trueis not true β and UB is not the vibe, bestie π
π Parameters π
(none) β literally zero parameters, we love a low-maintenance icon π«Ά
π Return value π
Reference to the unmatched prefix. Periodt π
πΈ Example πΈ
Run this code:
// 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';
}
β Output β
b
π See also π
- returns sub-sequence between the end of the full match and the end of the suffix target sequence (public member function) β yes bestie, that's the other one π
byeee π«Ά source: http://cppreference.com; version/date: 2024.06.10; page: std::match_results::prefix(3). mwah π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms