diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | libsylph/filter.c | 5 |
2 files changed, 10 insertions, 2 deletions
@@ -1,6 +1,11 @@ +2015-12-02 + + * libsylph/filter.c: strmatch_regex(): fixed regex match when using + Oniguruma (r3481 made it match only the head of searched string). + 2015-11-27 - * version 3.5.0 + * version 3.5.0rc 2015-11-27 diff --git a/libsylph/filter.c b/libsylph/filter.c index 873e32df..1a3bb4ae 100644 --- a/libsylph/filter.c +++ b/libsylph/filter.c @@ -341,6 +341,7 @@ static gboolean strmatch_regex(const gchar *haystack, const gchar *needle) OnigErrorInfo err_info; const UChar *ptn = (const UChar *)needle; const UChar *str = (const UChar *)haystack; + size_t haystack_len; ret = onig_new(®, ptn, ptn + strlen(needle), ONIG_OPTION_IGNORECASE|ONIG_OPTION_EXTEND, @@ -349,7 +350,9 @@ static gboolean strmatch_regex(const gchar *haystack, const gchar *needle) if (ret != ONIG_NORMAL) return FALSE; - ret = onig_match(reg, str, str + strlen(haystack), str, NULL, 0); + haystack_len = strlen(haystack); + ret = onig_search(reg, str, str + haystack_len, + str, str + haystack_len, NULL, 0); onig_free(reg); if (ret >= 0) |