Function

GLibRegexcheck_replacement

Declaration

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

Description

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 an error.

The argument can be NULL.
The argument will be set to NULL by the function if there are no errors.
In case of error, the argument will be set and 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.