mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-12-10 18:43:42 +01:00
GRegex: add g_regex_get_max_lookbehind()
It is useful for multi-segment regex matching. A unit test is included. https://bugzilla.gnome.org/show_bug.cgi?id=689794
This commit is contained in:
@@ -1519,6 +1519,29 @@ g_regex_get_has_cr_or_lf (const GRegex *regex)
|
||||
return !!value;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_regex_get_max_lookbehind:
|
||||
* @regex: a #GRegex structure
|
||||
*
|
||||
* Gets the number of characters in the longest lookbehind assertion in the
|
||||
* pattern. This information is useful when doing multi-segment matching using
|
||||
* the partial matching facilities.
|
||||
*
|
||||
* Returns: the number of characters in the longest lookbehind assertion.
|
||||
*
|
||||
* Since: 2.38
|
||||
*/
|
||||
gint
|
||||
g_regex_get_max_lookbehind (const GRegex *regex)
|
||||
{
|
||||
gint max_lookbehind;
|
||||
|
||||
pcre_fullinfo (regex->pcre_re, regex->extra,
|
||||
PCRE_INFO_MAXLOOKBEHIND, &max_lookbehind);
|
||||
|
||||
return max_lookbehind;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_regex_get_compile_flags:
|
||||
* @regex: a #GRegex
|
||||
|
||||
Reference in New Issue
Block a user