Method

GLibMatchInfofetch_named

Declaration

gchar*
g_match_info_fetch_named (
  const GMatchInfo* match_info,
  const gchar* name
)

Description

Retrieves the text matching 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 “(?Pa)?b”) then an empty string is returned.

The string is fetched from the string passed to the match function, so you cannot call this function after freeing the string.

Available since:2.14

Parameters

name const gchar*
 

Name of the subexpression.

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

Return value

Returns: utf8
 

The matched substring, or NULL if an error occurred. You have to free the string yourself.

 The caller of the method takes ownership of the data, and is responsible for freeing it.
 The return value can be NULL.
 The string is a NUL terminated UTF-8 string.