regex_regex_match

regex_regex_match (정규식 전체 일치)

std::regex_match은 정규식이 대상 문자 시퀀스 전체와 일치하는지 결정하는 함수예요. C++11부터 사용할 수 있어요.

출처: cppreference

본문

<regex> 헤더에 정의되어 있고, 시그니처는 다음과 같아요.

template< class BidirIt, class Alloc, class CharT, class Traits >
bool regex_match( BidirIt first, BidirIt last,
                  std::match_results<BidirIt, Alloc>& m,
                  const std::basic_regex<CharT, Traits>& e,
                  std::regex_constants::match_flag_type flags =
                      std::regex_constants::match_default );

(1) (since C++11)

template< class BidirIt, class CharT, class Traits >
bool regex_match( BidirIt first, BidirIt last,
                  const std::basic_regex<CharT, Traits>& e,
                  std::regex_constants::match_flag_type flags =
                      std::regex_constants::match_default );

(2) (since C++11)

template< class CharT, class Alloc, class Traits >
bool regex_match( const CharT* str,
                  std::match_results<const CharT*, Alloc>& m,
                  const std::basic_regex<CharT, Traits>& e,
                  std::regex_constants::match_flag_type flags =
                      std::regex_constants::match_default );

(3)

정규식이 대상 문자 시퀀스 전체와 일치하는지 결정해요.

    1. 시퀀스 [first, last) 전체가 정규식 e와 일치하는지 결정해요. 성공 시 일치 결과를 m에 담아요.
    1. 시퀀스 [first, last) 전체가 정규식 e와 일치하는지 결정해요.
    1. null 종료 문자열 str이 정규식 e와 일치하는지 결정해요. 성공 시 일치 결과를 m에 담아요.

반환값 (Return value)

정규식이 시퀀스 전체와 일치하면 true, 그 외에는 false.

참고 (Notes)

regex_match는 정규식으로 전체 문자열이 정확히 일치해야 해요(부분 일치가 아님). 부분 일치를 찾으려면 std::regex_search를 사용해요.

더 알아보기 (Learn more)

cppreference