return _("workspace limit for empty substrings reached");
case PCRE_ERROR_BADNEWLINE:
return _("invalid combination of newline flags");
+ case PCRE_ERROR_BADOFFSET:
+ return _("bad offset");
+ case PCRE_ERROR_SHORTUTF8:
+ return _("short utf8");
default:
break;
}
prev_match_start = match_info->offsets[0];
prev_match_end = match_info->offsets[1];
+ if (match_info->pos > match_info->string_len)
+ {
+ /* we have reached the end of the string */
+ match_info->pos = -1;
+ match_info->matches = PCRE_ERROR_NOMATCH;
+ return FALSE;
+ }
+
match_info->matches = pcre_exec (match_info->regex->pcre_re,
match_info->regex->extra,
match_info->string,
compile_options |= PCRE_NEWLINE_ANY;
}
+ compile_options |= PCRE_UCP;
+
/* compile the pattern */
re = pcre_compile2 (pattern, compile_options, &errcode,
&errmsg, &erroffset, NULL);
regex = g_regex_new (pattern, compile_options, 0, NULL);
if (!regex)
return NULL;
+
result = g_regex_split_full (regex, string, -1, 0, match_options, 0, NULL);
g_regex_unref (regex);
return result;
match_ok = g_regex_match_full (regex, string, string_len, start_position,
match_options, &match_info, &tmp_error);
+
while (tmp_error == NULL)
{
if (match_ok)
#define PCRE_UTF8 0x00000800
#define PCRE_NO_UTF8_CHECK 0x00002000
#define PCRE_NEWLINE_ANY 0x00400000
+#define PCRE_UCP 0x20000000
static void
test_basic (void)
regex = g_regex_new ("[A-Z]+", cflags, mflags, NULL);
g_assert (regex != NULL);
- g_assert_cmpint (g_regex_get_compile_flags (regex), ==, cflags|PCRE_UTF8|PCRE_NO_UTF8_CHECK|PCRE_NEWLINE_ANY );
+ g_assert_cmpint (g_regex_get_compile_flags (regex), ==, cflags|PCRE_UTF8|PCRE_NO_UTF8_CHECK|PCRE_NEWLINE_ANY|PCRE_UCP );
g_assert_cmpint (g_regex_get_match_flags (regex), ==, mflags|PCRE_NO_UTF8_CHECK);
g_regex_unref (regex);
{
setlocale (LC_ALL, "");
- g_setenv ("G_DEBUG", "fatal_warnings", TRUE);
-
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/regex/basic", test_basic);