GLib.MatchInfo.fetch_named_pos

### Method

# GLib MatchInfofetch_named_pos

since: 2.14

#### Declaration [src]

    gboolean
    g_match_info_fetch_named_pos (
      const GMatchInfo* match_info,
      const gchar* name,
      gint* start_pos,
      gint* end_pos
    )

#### Description [src]

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.

As `end_pos` is set to the byte after the final byte of the match (on success), the length of the match can be calculated as `end_pos - start_pos`.

Available since: 2.14

#### Parameters

`name`

  Type: `const gchar*`

  Name of the subexpression.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`start_pos`

  Type: `gint*`

  Pointer to location where to store the start position, or `NULL`.

  The argument will be set by the function.
  The argument can be `NULL`.

`end_pos`

  Type: `gint*`

  Pointer to location where to store the end position (the byte after the final byte of the match), or `NULL`.

  The argument will be set by the function.
  The argument can be `NULL`.

#### Return value

Type: `gboolean`

`TRUE` if the position was fetched, `FALSE` otherwise. If the position cannot be fetched, `start_pos` and `end_pos` are left unchanged.