VteRegex

VteRegex — Regex for matching and searching. Uses PCRE2 internally.

Functions

Types and Values

Object Hierarchy

    GBoxed
    ╰── VteRegex

Description

Functions

vte_regex_ref ()

VteRegex *
vte_regex_ref (VteRegex *regex);

Decreases the reference count of regex by one, and frees regex if the refcount reaches zero.

Parameters

regex

a VteRegex.

[transfer full]

Returns

NULL


vte_regex_unref ()

VteRegex *
vte_regex_unref (VteRegex *regex);

vte_regex_new_for_match ()

VteRegex *
vte_regex_new_for_match (const char *pattern,
                         gssize pattern_length,
                         guint32 flags,
                         GError **error);

Compiles pattern into a regex for use as a match regex with vte_terminal_match_add_regex() or vte_terminal_event_check_regex_simple().

See man:pcre2pattern(3) for information about the supported regex language.

The regex will be compiled using PCRE2_UTF and possibly other flags, in addition to the flags supplied in flags .

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 unknown

 

flags

PCRE2 compile flags

 

error

return location for a GError, or NULL.

[allow-none]

Returns

a newly created VteRegex, or NULL with error filled in.

[transfer full]


vte_regex_new_for_search ()

VteRegex *
vte_regex_new_for_search (const char *pattern,
                          gssize pattern_length,
                          guint32 flags,
                          GError **error);

Compiles pattern into a regex for use as a search regex with vte_terminal_search_set_regex().

See man:pcre2pattern(3) for information about the supported regex language.

The regex will be compiled using PCRE2_UTF and possibly other flags, in addition to the flags supplied in flags .

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 unknown

 

flags

PCRE2 compile flags

 

error

return location for a GError, or NULL.

[allow-none]

Returns

a newly created VteRegex, or NULL with error filled in.

[transfer full]


vte_regex_jit ()

gboolean
vte_regex_jit (VteRegex *regex,
               guint32 flags,
               GError **error);

If the platform supports JITing, JIT compiles regex .

Parameters

regex

a VteRegex

 

Returns

TRUE if JITing succeeded (or PCRE2 was built without JIT support), or FALSE with error filled in


vte_regex_substitute ()

char *
vte_regex_substitute (VteRegex *regex,
                      const char *subject,
                      const char *replacement,
                      guint32 flags,
                      GError **error);

See man:pcre2api(3) on pcre2_substitute() for more information.

Parameters

regex

a VteRegex

 

subject

the subject string

 

replacement

the replacement string

 

flags

PCRE2 match flags

 

error

return location for a GError, or NULL.

[nullable]

Returns

the substituted string, or NULL if an error occurred.

[transfer full]

Since: 0.56

Types and Values

VteRegex

typedef struct _VteRegex VteRegex;