GLib.Regex.escape_string
Description: Reference for GLib.Regex.escape_string

### Function

# GLib Regexescape_string

since: 2.14

#### Declaration

    gchar*
    g_regex_escape_string (
      const gchar* string,
      gint length
    )

#### Description

Escapes the special characters used for regular expressions in `string`, for instance “a.b*c” becomes “a.b*c”. This function is useful to dynamically generate regular expressions.

`string` can contain nul characters that are replaced with “\0”, in this case remember to specify the correct length of `string` in `length`.

Available since: 2.14

#### Parameters

`string`

  Type: `const gchar*`

  The string to escape.

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

`length`

  Type: `gint`

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

#### Return value

Type: `gchar*`

A newly-allocated escaped string.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.