Function

GLibRegexnew

since: 2.14

Declaration

GRegex*
g_regex_new (
  const gchar* pattern,
  GRegexCompileFlags compile_options,
  GRegexMatchFlags match_options,
  GError** error
)

Description

Compiles the regular expression to an internal form, and does the initial setup of the GRegex structure.

Available since: 2.14

Parameters

pattern

Type: const gchar*

The regular expression.

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

Type: GRegexCompileFlags

Compile options for the regular expression, or 0

match_options

Type: GRegexMatchFlags

Match options for the regular expression, or 0

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 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: GRegex

A GRegex structure or NULL if an error occurred. Call g_regex_unref() when you are done with it.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The return value can be NULL.