]> source.dussan.org Git - rspamd.git/commitdiff
Add some more SA and perl compat for regexps.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 31 Mar 2015 12:46:57 +0000 (13:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 31 Mar 2015 12:46:57 +0000 (13:46 +0100)
src/libutil/regexp.c
test/lua/unit/regxep.lua

index a83660e8e3fdb777a31b91cb71e25c7268f954bc..61ddc908a2a575a1538841131c5299af5eb905a1 100644 (file)
@@ -135,6 +135,12 @@ rspamd_regexp_new (const gchar *pattern, const gchar *flags,
                else if (*start == 'm') {
                        start ++;
                        sep = *start;
+
+                       /* Paired braces */
+                       if (sep == '{') {
+                               sep = '}';
+                       }
+
                        rspamd_flags |= RSPAMD_REGEXP_FLAG_FULL_MATCH;
                }
                if (sep == '\0' || g_ascii_isalnum (sep)) {
index e33d20d4337f5467f0f30ec40ef595c79c5f58a6..04db54aa9b269bd89a85f2ae777aa062957c0273 100644 (file)
@@ -13,6 +13,7 @@ context("Regexp unit tests", function()
       {'/^test$/m', '123test', false},
       {'m,test,', 'test', true},
       {'m,test,', 'test123', false},
+      {'m{https?://[^/?\\s]+?:\\d+(?<!:80)(?<!:443)(?<!:8080)(?:/|\\s|$)}', '', false},
       {'/test/i', 'TeSt123', true},
       {'/тест/i', 'ТесТ', true},
       -- Raw regexp