### Method

# GLib Regex match_full

since: 2.14

#### Declaration [src]

    gboolean
    g_regex_match_full (
      const GRegex* regex,
      const gchar* string,
      gssize string_len,
      gint start_position,
      GRegexMatchFlags match_options,
      GMatchInfo** match_info,
      GError** error
    )

#### Description [src]

Scans for a match in `string` for the pattern in `regex`. The `match_options` are combined with the match options specified when the `regex` structure was created, letting you have more flexibility in reusing `GRegex` structures.

Setting `start_position` differs from just passing over a shortened string and setting `G_REGEX_MATCH_NOTBOL` in the case of a pattern that begins with any kind of lookbehind assertion, such as “\b”.

Unless `G_REGEX_RAW` is specified in the options, `string` must be valid UTF-8.

A `GMatchInfo` structure, used to get information on the match, is stored in `match_info` if not `NULL`. Note that if `match_info` is not `NULL` then it is created even if the function returns `FALSE`, i.e. you must free it regardless if regular expression actually matched.

`string` is not copied and is used in `GMatchInfo` internally. If you use any `GMatchInfo` method (except g_match_info_free()) after freeing or modifying `string` then the behaviour is undefined.

To retrieve all the non-overlapping matches of the pattern in string you can use g_match_info_next().

    static void
    print_uppercase_words (const gchar *string)
    {
      // Print all uppercase-only words.
      GRegex *regex;
      GMatchInfo *match_info;
      GError *error = NULL;

      regex = g_regex_new ("[A-Z]+", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
      g_regex_match_full (regex, string, -1, 0, 0, &match_info, &error);
      while (g_match_info_matches (match_info))
        {
          gchar *word = g_match_info_fetch (match_info, 0);
          g_print ("Found: %s\n", word);
          g_free (word);
          g_match_info_next (match_info, &error);
        }
      g_match_info_free (match_info);
      g_regex_unref (regex);
      if (error != NULL)
        {
          g_printerr ("Error while matching: %s\n", error->message);
          g_error_free (error);
        }
    }

Available since: 2.14

#### Parameters

`string`

  Type: An array of `gchar`

  The string to scan for matches.

  The length of the array is specified in the `string_len` argument.
  The data is owned by the caller of the method.
  Each element is a NUL terminated UTF-8 string.

`string_len`

  Type: `gssize`

  The length of `string`, in bytes, or -1 if `string` is nul-terminated.

`start_position`

  Type: `gint`

  Starting index of the string to match, in bytes.

`match_options`

  Type: `GRegexMatchFlags`

  Match options.

`match_info`

  Type: `GMatchInfo`

  Pointer to location where to store the `GMatchInfo`, or `NULL` if you do not need it.

  The argument will be set by the function.
  The argument can be `NULL`.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` is the string matched, `FALSE` otherwise.