:right-sidebar: True Regex =================================================================== .. currentmodule:: gi.repository.Vte .. class:: Regex(*args, **kwargs) :no-contents-entry: :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 ------------ .. rst-class:: interim-class .. class:: Regex :no-index: .. classmethod:: new_for_match(pattern: str, pattern_length: int, flags: int) -> ~gi.repository.Vte.Regex Compiles ``pattern`` into a regex for use as a match regex with :func:`~gi.repository.Vte.Terminal.match_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 in ``flags``\. :param pattern: a regex pattern string :param pattern_length: the length of ``pattern`` in bytes, or -1 if the string is NUL-terminated and the length is unknown :param flags: PCRE2 compile flags .. classmethod:: new_for_match_full(pattern: str, pattern_length: int, flags: int, extra_flags: int) -> ~typing.Tuple[~gi.repository.Vte.Regex, int] Compiles ``pattern`` into a regex for use as a match regex with :func:`~gi.repository.Vte.Terminal.match_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`` and ``extra_flags``\. The regex will be compiled using ``PCRE2_UTF`` and possibly other flags, in addition to the flags supplied in ``flags``\. If regex compilation fails, ``error`` will be set and ``error_offset`` point to error as an offset into ``pattern``\. .. versionadded:: 0.76 :param pattern: a regex pattern string :param pattern_length: the length of ``pattern`` in bytes, or -1 if the string is NUL-terminated and the length is unknown :param flags: PCRE2 compile flags :param extra_flags: PCRE2 extra compile flags .. classmethod:: new_for_search(pattern: str, pattern_length: int, flags: int) -> ~gi.repository.Vte.Regex Compiles ``pattern`` into a regex for use as a search regex with :func:`~gi.repository.Vte.Terminal.search_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 in ``flags``\. :param pattern: a regex pattern string :param pattern_length: the length of ``pattern`` in bytes, or -1 if the string is NUL-terminated and the length is unknown :param flags: PCRE2 compile flags .. classmethod:: new_for_search_full(pattern: str, pattern_length: int, flags: int, extra_flags: int) -> ~typing.Tuple[~gi.repository.Vte.Regex, int] Compiles ``pattern`` into a regex for use as a search regex with :func:`~gi.repository.Vte.Terminal.search_set_regex`. See man:pcre2pattern(3) for information about the supported regex language, and man:pcre2api(3) for information about the supported ``flags`` and ``extra_flags``\. The regex will be compiled using ``PCRE2_UTF`` and possibly other flags, in addition to the flags supplied in ``flags``\. If regex compilation fails, ``error`` will be set and ``error_offset`` point to error as an offset into ``pattern``\. .. versionadded:: 0.76 :param pattern: a regex pattern string :param pattern_length: the length of ``pattern`` in bytes, or -1 if the string is NUL-terminated and the length is unknown :param flags: PCRE2 compile flags :param extra_flags: Methods ------- .. rst-class:: interim-class .. class:: Regex :no-index: .. method:: jit(flags: int) -> bool If the platform supports JITing, JIT compiles ``regex``\. :param flags: PCRE2 JIT flags, or 0 .. method:: substitute(subject: str, replacement: str, flags: int) -> str See man:pcre2api(3) and man:pcre2_substitute(3) for more information. .. versionadded:: 0.56 :param subject: the subject string :param replacement: the replacement string :param flags: PCRE2 match flags