Namespaces
Variants

std::match_results<BidirIt,Alloc>:: prefix

From cppreference.net
Regular expressions library
Classes
(C++11)
Algorithms
Iterators
Exceptions
Traits
Constants
(C++11)
Regex Grammar
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

참고 항목

전체 매치의 끝과 대상 시퀀스의 끝 사이의 부분 시퀀스를 반환합니다
(public member function)