MatchInfo
Object Hierarchy:
Description:
GMatchInfo is used to retrieve information about the regular expression match which created it.
This structure is opaque and its fields cannot be accessed directly.
Namespace: GLib
Package: glib-2.0
Content:
Methods:
-
public weak Regex get_regex ()
Returns GRegex object used in match_info.
-
public unowned string get_string ()
Returns the string searched with match_info. This is the string passed to g_regex_match() or
g_regex_replace() so you may not free it before calling this function.
-
public bool matches ()
Returns whether the previous match operation succeeded.
-
public bool next () throws RegexError
Scans for the next match using the same parameters of the previous call to g_regex_match_full() or
g_regex_match() that returned match_info.
-
public int get_match_count ()
Retrieves the number of matched substrings (including substring 0, that is the whole matched text), so 1
is returned if the pattern has no substrings in it and 0 is returned if the match failed.
-
public bool is_partial_match ()
Usually if the string passed to g_regex_match*() matches as far as it goes, but is too short to match
the entire pattern, FALSE is returned.
-
public string expand_references (string string_to_expand) throws RegexError
Returns a new string containing the text in string_to_expand with references and escape sequences
expanded.
-
public string? fetch (int match_num)
Retrieves the text matching the match_num'th capturing parentheses. 0 is the full text of the match, 1
is the first paren set, 2 the second, and so on.
-
public bool fetch_pos (int match_num, out int start_pos, out int end_pos)
Retrieves the position in bytes of the match_num'th capturing parentheses. 0 is the full text of the
match, 1 is the first paren set, 2 the second, and so on.
-
public string? fetch_named (string name)
Retrieves the text matching the capturing parentheses named name.
-
public bool fetch_named_pos (string name, out int start_pos, out int end_pos)
Retrieves the position in bytes of the capturing parentheses named name.
-
public string[] fetch_all ()
Bundles up pointers to each of the matching substrings from a match and stores them in an array of gchar
pointers. The first element in the returned array is the match number 0, i.e. the entire matched text.