Regex#

class Regex(**kwargs)#
Constructors:

new(pattern:str, compile_options:GLib.RegexCompileFlags, match_options:GLib.RegexMatchFlags) -> GLib.Regex or None

Constructors#

class Regex
classmethod new(pattern: str, compile_options: RegexCompileFlags, match_options: RegexMatchFlags) Regex | None#
Parameters:
  • pattern

  • compile_options

  • match_options

Methods#

class Regex
check_replacement(replacement: str) tuple[bool, bool]#
Parameters:

replacement

error_quark() int#
escape_nul(string: str, length: int) str#
Parameters:
  • string

  • length

escape_string(string: str, length: int) str#
Parameters:
  • string

  • length

get_capture_count() int#
get_compile_flags() RegexCompileFlags#
get_has_cr_or_lf() bool#
get_match_flags() RegexMatchFlags#
get_max_backref() int#
get_max_lookbehind() int#
get_pattern() str#
get_string_number(name: str) int#
Parameters:

name

match(string: str, match_options: RegexMatchFlags) tuple[bool, MatchInfo]#
Parameters:
  • string

  • match_options

match_all(string: str, match_options: RegexMatchFlags) tuple[bool, MatchInfo]#
Parameters:
  • string

  • match_options

match_all_full(string: Sequence[str], start_position: int, match_options: RegexMatchFlags) tuple[bool, MatchInfo]#
Parameters:
  • string

  • start_position

  • match_options

match_full(string: Sequence[str], start_position: int, match_options: RegexMatchFlags) tuple[bool, MatchInfo]#
Parameters:
  • string

  • start_position

  • match_options

match_simple(pattern: str, string: str, compile_options: RegexCompileFlags, match_options: RegexMatchFlags) bool#
Parameters:
  • pattern

  • string

  • compile_options

  • match_options

replace(string: Sequence[str], start_position: int, replacement: str, match_options: RegexMatchFlags) str#
Parameters:
  • string

  • start_position

  • replacement

  • match_options

replace_eval(string: Sequence[str], start_position: int, match_options: RegexMatchFlags, eval: Callable[[...], bool], *user_data: Any) str#
Parameters:
  • string

  • start_position

  • match_options

  • eval

  • user_data

replace_literal(string: Sequence[str], start_position: int, replacement: str, match_options: RegexMatchFlags) str#
Parameters:
  • string

  • start_position

  • replacement

  • match_options

split(string: str, match_options: RegexMatchFlags) list[str]#
Parameters:
  • string

  • match_options

split_full(string: Sequence[str], start_position: int, match_options: RegexMatchFlags, max_tokens: int) list[str]#
Parameters:
  • string

  • start_position

  • match_options

  • max_tokens

split_simple(pattern: str, string: str, compile_options: RegexCompileFlags, match_options: RegexMatchFlags) list[str]#
Parameters:
  • pattern

  • string

  • compile_options

  • match_options