Namespaces
Variants

std:: basic_regex constants

From cppreference.net
Regular expressions library
Classes
(C++11)
Algorithms
Iterators
Exceptions
Traits
Constants
(C++11)
Regex Grammar
헤더에 정의됨 <regex>
static constexpr std:: regex_constants :: syntax_option_type icase =

std:: regex_constants :: icase ;
static constexpr std:: regex_constants :: syntax_option_type nosubs =
std:: regex_constants :: nosubs ;
static constexpr std:: regex_constants :: syntax_option_type optimize =
std:: regex_constants :: optimize ;
static constexpr std:: regex_constants :: syntax_option_type collate =
std:: regex_constants :: collate ;
static constexpr std:: regex_constants :: syntax_option_type ECMAScript =
std:: regex_constants :: ECMAScript ;
static constexpr std:: regex_constants :: syntax_option_type basic =
std:: regex_constants :: basic ;
static constexpr std:: regex_constants :: syntax_option_type extended =
std:: regex_constants :: extended ;
static constexpr std:: regex_constants :: syntax_option_type awk =
std:: regex_constants :: awk ;
static constexpr std:: regex_constants :: syntax_option_type grep =
std:: regex_constants :: grep ;
static constexpr std:: regex_constants :: syntax_option_type egrep =

std:: regex_constants :: egrep ;
(C++17부터)

std::basic_regex 는 일반 정규식 매칭 구문을 제어하는 여러 상수를 정의합니다.

이 상수들은 std :: regex_constants 에서 복제되었습니다:

문법 옵션 효과
ECMAScript 수정된 ECMAScript 정규 표현식 문법 을 사용합니다.
basic 기본 POSIX 정규 표현식 문법을 사용합니다 ( 문법 문서 ).
extended 확장 POSIX 정규 표현식 문법을 사용합니다 ( 문법 문서 ).
awk POSIX에서 awk 유틸리티가 사용하는 정규 표현식 문법을 사용합니다 ( 문법 문서 ).
grep POSIX에서 grep 유틸리티가 사용하는 정규 표현식 문법을 사용합니다. 이는 기본적으로 basic 옵션과 동일하지만, 새 줄 ' \n ' 을 교체 구분자로 추가합니다.
egrep POSIX에서 grep 유틸리티가 -E 옵션과 함께 사용하는 정규 표현식 문법을 사용합니다. 이는 기본적으로 extended 옵션과 동일하지만, '|' 에 추가로 새 줄 ' \n ' 을 교체 구분자로 추가합니다.
문법 변형 효과
icase 문자 매칭 시 대소문자를 구분하지 않습니다.
nosubs 매칭을 수행할 때, 모든 표시된 부분 표현식 ( expr ) 은 비표시 부분 표현식 (?: expr ) 으로 처리됩니다. 제공된 std::regex_match 구조체에 매치가 저장되지 않으며 mark_count() 는 0입니다.
optimize 정규 표현식 엔진에게 매칭 속도를 높이도록 지시하며, 대신 생성 시간이 더 느려질 수 있습니다. 예를 들어, 비결정적 FSA를 결정적 FSA로 변환할 수 있습니다.
collate "[a-b]" 형태의 문자 범위가 로케일을 고려합니다.
multiline (C++17) ECMAScript 엔진이 선택된 경우, ^ 이 줄의 시작과 매치되고 $ 이 줄의 끝과 매치되도록 지정합니다.

문법 옵션 중 최대 하나만 ECMAScript , basic , extended , awk , grep , egrep 에서 선택할 수 있습니다. 문법을 선택하지 않으면 ECMAScript 가 선택된 것으로 간주됩니다. 다른 옵션들은 변형으로 작동하며, 예를 들어 std:: regex ( "meow" , std :: regex :: icase ) std:: regex ( "meow" , std :: regex :: ECMAScript | std :: regex :: icase ) 와 동등합니다.

참고 항목

정규식 동작을 제어하는 일반 옵션
(typedef)