g_regex_get_pattern
g_regex_get_max_backref
g_regex_get_capture_count
+g_regex_get_has_cr_or_lf
g_regex_get_string_number
g_regex_get_compile_flags
g_regex_get_match_flags
g_regex_get_pattern
g_regex_get_max_backref
g_regex_get_capture_count
+g_regex_get_has_cr_or_lf
g_regex_get_string_number
g_regex_get_compile_flags
g_regex_get_match_flags
return value;
}
+/**
+ * g_regex_get_has_cr_or_lf:
+ * @regex: a #GRegex structure
+ *
+ * Checks whether the pattern contains explicit CR or LF references.
+ *
+ * Returns: %TRUE if the pattern contains explicit CR or LF references
+ *
+ * Since: 2.34
+ */
+gboolean
+g_regex_get_has_cr_or_lf (const GRegex *regex)
+{
+ gint value;
+
+ pcre_fullinfo (regex->pcre_re, regex->extra,
+ PCRE_INFO_HASCRORLF, &value);
+
+ return !!value;
+}
+
/**
* g_regex_get_compile_flags:
* @regex: a #GRegex
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);
+gboolean g_regex_get_has_cr_or_lf (const GRegex *regex);
gint g_regex_get_string_number (const GRegex *regex,
const gchar *name);
gchar *g_regex_escape_string (const gchar *string,
g_assert_cmpint (count, ==, 2);
}
+static void
+test_explicit_crlf (void)
+{
+ GRegex *regex;
+
+ regex = g_regex_new ("[\r\n]a", 0, 0, NULL);
+ g_assert_cmpint (g_regex_get_has_cr_or_lf (regex), ==, TRUE);
+ g_regex_unref (regex);
+}
+
int
main (int argc, char *argv[])
{
g_test_add_func ("/regex/condition", test_condition);
g_test_add_func ("/regex/recursion", test_recursion);
g_test_add_func ("/regex/multiline", test_multiline);
+ g_test_add_func ("/regex/explicit-crlf", test_explicit_crlf);
/* TEST_NEW(pattern, compile_opts, match_opts) */
TEST_NEW("", 0, 0);