### Function

# GLib Regex check_replacement

since: 2.14

#### Declaration [src]

    gboolean
    g_regex_check_replacement (
      const gchar* replacement,
      gboolean* has_references,
      GError** error
    )

#### Description [src]

Checks whether `replacement` is a valid replacement string (see g_regex_replace()), i.e. that all escape sequences in it are valid.

If `has_references` is not `NULL` then `replacement` is checked for pattern references. For instance, replacement text ‘foo\n’ does not contain references and may be evaluated without information about actual match, but ‘\0\1’ (whole match followed by first subpattern) requires valid `GMatchInfo` object.

Available since: 2.14

#### Parameters

`replacement`

  Type: `const gchar*`

  The replacement string.

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

`has_references`

  Type: `gboolean*`

  Location to store information about references in `replacement` or `NULL`.

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

`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 function 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`

Whether `replacement` is a valid replacement string.