Add g_regex_get_max_backref() and g_regex_get_capture_count(). (#419371,

2007-04-30  Matthias Clasen  <mclasen@redhat.com>

        * glib/glib.symbols:
        * glib/gregex.[hc]: Add g_regex_get_max_backref() and
        g_regex_get_capture_count().  (#419371, Marco Barisione)


svn path=/trunk/; revision=5469
This commit is contained in:
Matthias Clasen 2007-04-30 16:37:38 +00:00 committed by Matthias Clasen
parent a793051fda
commit 88651f758b
6 changed files with 60 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2007-04-30 Matthias Clasen <mclasen@redhat.com>
* glib/glib.symbols:
* glib/gregex.[hc]: Add g_regex_get_max_backref() and
g_regex_get_capture_count(). (#419371, Marco Barisione)
2007-04-30 Matthias Clasen <mclasen@redhat.com>
* glib/glib.symbols:

View File

@ -1,3 +1,7 @@
2007-04-30 Matthias Clasen <mclasen@redhat.com>
* glib/glib-sections.txt: Add new regex functions
2007-04-30 Matthias Clasen <mclasen@redhat.com>
* glib/glib-sections.txt:

View File

@ -875,6 +875,8 @@ GRegexEvalCallback
g_regex_new
g_regex_free
g_regex_get_pattern
g_regex_get_max_backref
g_regex_get_capture_count
g_regex_get_string_number
g_regex_escape_string
g_regex_match_simple

View File

@ -1425,6 +1425,8 @@ g_regex_error_quark
g_regex_new
g_regex_free
g_regex_get_pattern
g_regex_get_max_backref
g_regex_get_capture_count
g_regex_get_string_number
g_regex_escape_string
g_regex_match_simple

View File

@ -873,6 +873,50 @@ g_regex_get_pattern (const GRegex *regex)
return regex->pattern;
}
/**
* g_regex_get_max_backref:
* @regex: a #GRegex
*
* Returns the number of the highest back reference
* in the pattern, or 0 if the pattern does not contain
* back references.
*
* Returns: the number of the highest back reference.
*
* Since: 2.14
*/
gint
g_regex_get_max_backref (const GRegex *regex)
{
gint value;
pcre_fullinfo (regex->pcre_re, regex->extra,
PCRE_INFO_BACKREFMAX, &value);
return value;
}
/**
* g_regex_get_capture_count:
* @regex: a #GRegex
*
* Returns the number of capturing subpatterns in the pattern.
*
* Returns: the number of capturing subpatterns.
*
* Since: 2.14
*/
gint
g_regex_get_capture_count (const GRegex *regex)
{
gint value;
pcre_fullinfo (regex->pcre_re, regex->extra,
PCRE_INFO_CAPTURECOUNT, &value);
return value;
}
/**
* g_regex_match_simple:
* @pattern: the regular expression

View File

@ -90,6 +90,8 @@ GRegex *g_regex_new (const gchar *pattern,
GError **error);
void g_regex_free (GRegex *regex);
const gchar *g_regex_get_pattern (const GRegex *regex);
gint g_regex_get_max_backref (const GRegex *regex);
gint g_regex_get_capture_count (const GRegex *regex);
gint g_regex_get_string_number (const GRegex *regex,
const gchar *name);
gchar *g_regex_escape_string (const gchar *string,