Function

GLibRegexmatch_simple

since: 2.14

Declaration

gboolean
g_regex_match_simple (
  const gchar* pattern,
  const gchar* string,
  GRegexCompileFlags compile_options,
  GRegexMatchFlags match_options
)

Description

Scans for a match in string for pattern.

This function is equivalent to g_regex_match() but it does not require to compile the pattern with g_regex_new(), avoiding some lines of code when you need just to do a match without extracting substrings, capture counts, and so on.

If this function is to be called on the same pattern more than once, it’s more efficient to compile the pattern once with g_regex_new() and then use g_regex_match().

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.
string

Type: const gchar*

The string to scan for matches.

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, or 0

Return value

Type: gboolean

TRUE if the string matched, FALSE otherwise.