Regex
- class Regex(*args, **kwargs)
- Constructors:
new_for_match(pattern:str, pattern_length:int, flags:int) -> Vte.Regex
new_for_match_full(pattern:str, pattern_length:int, flags:int, extra_flags:int) -> Vte.Regex, error_offset:int
new_for_search(pattern:str, pattern_length:int, flags:int) -> Vte.Regex
new_for_search_full(pattern:str, pattern_length:int, flags:int, extra_flags:int) -> Vte.Regex, error_offset:int
Constructors
- class Regex
- classmethod new_for_match(pattern: str, pattern_length: int, flags: int) Regex
Compiles
pattern
into a regex for use as a match regex withmatch_add_regex()
or vte_terminal_event_check_regex_simple().See man:pcre2pattern(3) for information about the supported regex language, and man:pcre2api(3) for information about the supported
flags
.The regex will be compiled using
PCRE2_UTF
and possibly other flags, in addition to the flags supplied inflags
.- Parameters:
pattern – a regex pattern string
pattern_length – the length of
pattern
in bytes, or -1 if the string is NUL-terminated and the length is unknownflags – PCRE2 compile flags
- classmethod new_for_match_full(pattern: str, pattern_length: int, flags: int, extra_flags: int) tuple[Regex, int]
Compiles
pattern
into a regex for use as a match regex withmatch_add_regex()
or vte_terminal_event_check_regex_simple().See man:pcre2pattern(3) for information about the supported regex language, and man:pcre2api(3) for information about the supported
flags
andextra_flags
.The regex will be compiled using
PCRE2_UTF
and possibly other flags, in addition to the flags supplied inflags
.If regex compilation fails,
error
will be set anderror_offset
point to error as an offset intopattern
.Added in version 0.76.
- Parameters:
pattern – a regex pattern string
pattern_length – the length of
pattern
in bytes, or -1 if the string is NUL-terminated and the length is unknownflags – PCRE2 compile flags
extra_flags – PCRE2 extra compile flags
- classmethod new_for_search(pattern: str, pattern_length: int, flags: int) Regex
Compiles
pattern
into a regex for use as a search regex withsearch_set_regex()
.See man:pcre2pattern(3) for information about the supported regex language, and man:pcre2api(3) for information about the supported
flags
.The regex will be compiled using
PCRE2_UTF
and possibly other flags, in addition to the flags supplied inflags
.- Parameters:
pattern – a regex pattern string
pattern_length – the length of
pattern
in bytes, or -1 if the string is NUL-terminated and the length is unknownflags – PCRE2 compile flags
- classmethod new_for_search_full(pattern: str, pattern_length: int, flags: int, extra_flags: int) tuple[Regex, int]
Compiles
pattern
into a regex for use as a search regex withsearch_set_regex()
.See man:pcre2pattern(3) for information about the supported regex language, and man:pcre2api(3) for information about the supported
flags
andextra_flags
.The regex will be compiled using
PCRE2_UTF
and possibly other flags, in addition to the flags supplied inflags
.If regex compilation fails,
error
will be set anderror_offset
point to error as an offset intopattern
.Added in version 0.76.
- Parameters:
pattern – a regex pattern string
pattern_length – the length of
pattern
in bytes, or -1 if the string is NUL-terminated and the length is unknownflags – PCRE2 compile flags
extra_flags