GLib.MatchInfo.prototype.fetch_pos
function fetch_pos(match_num: Number(gint)): [ok: Boolean, start_pos: Number(gint), end_pos: Number(gint)] { // Gjs wrapper for g_match_info_fetch_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.
If match_num is a valid sub pattern but it didn't match anything (e.g. sub pattern 1, matching "b" against "(a)?b") then start_pos and end_pos are set to -1 and true is returned.
If the match was obtained using the DFA algorithm, that is using GLib.Regex.prototype.match_all or GLib.Regex.prototype.match_all_full, the retrieved position is not that of a set of parentheses but that of a matched substring. Substrings are matched in reverse order of length, so 0 is the longest match.
Since 2.14
- match_num
number of the sub expression
- ok
true if the position was fetched, false otherwise. If the position cannot be fetched, start_pos and end_pos are left unchanged
- start_pos
pointer to location where to store the start position, or null
- end_pos
pointer to location where to store the end position, or null