diff --git a/moo/mooutils/eggregex.c b/moo/mooutils/eggregex.c index fb16cd39..9b9d940a 100644 --- a/moo/mooutils/eggregex.c +++ b/moo/mooutils/eggregex.c @@ -443,8 +443,7 @@ egg_regex_fetch_pos (EggRegex *regex, { /* make sure the sub expression number they're requesting is less than * the total number of sub expressions that were matched. */ - if (match_num >= regex->matches) - return; + g_return_if_fail (match_num < regex->matches); if (start_pos) *start_pos = regex->offsets[2 * match_num]; @@ -1366,3 +1365,13 @@ egg_regex_escape (const char *string, return escaped; } + + +int +egg_regex_get_string_number (EggRegex *regex, + const char *name) +{ + g_return_val_if_fail (regex != NULL, PCRE_ERROR_NULL); + g_return_val_if_fail (name != NULL, PCRE_ERROR_NULL); + return _pcre_get_stringnumber (regex->regex, name); +} diff --git a/moo/mooutils/eggregex.h b/moo/mooutils/eggregex.h index 76ab4ab7..c6c35146 100644 --- a/moo/mooutils/eggregex.h +++ b/moo/mooutils/eggregex.h @@ -166,6 +166,10 @@ gchar *egg_regex_replace_eval (EggRegex *regex, gpointer user_data, EggRegexMatchFlags match_options); +int egg_regex_get_string_number (EggRegex *regex, + const char *name); + + gchar *egg_regex_eval_replacement (EggRegex *regex, const gchar *string, const gchar *replacement,