GLib.MatchInfo.prototype.fetch_named_pos

function fetch_named_pos(name: String): [ok: Boolean, start_pos: Number(gint), end_pos: Number(gint)] {
    // Gjs wrapper for g_match_info_fetch_named_pos()
}
  

Retrieves the position in bytes of the capturing parentheses named name.

If name is a valid sub pattern name but it didn't match anything (e.g. sub pattern "X", matching "b" against "(?P<X>a)?b") then start_pos and end_pos are set to -1 and true is returned.

Since 2.14

name

name of the subexpression

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