aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-31 13:46:57 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-31 13:46:57 +0100
commit4704ee4297fc4f5510421dea08965a83efa22397 (patch)
tree34eabcc692638c2c51346605d151aca5d03274ae
parent8a17010c05fefde3b5775586fa9b373549083cd3 (diff)
downloadrspamd-4704ee4297fc4f5510421dea08965a83efa22397.tar.gz
rspamd-4704ee4297fc4f5510421dea08965a83efa22397.zip
Add some more SA and perl compat for regexps.
-rw-r--r--src/libutil/regexp.c6
-rw-r--r--test/lua/unit/regxep.lua1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index a83660e8e..61ddc908a 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -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)) {
diff --git a/test/lua/unit/regxep.lua b/test/lua/unit/regxep.lua
index e33d20d43..04db54aa9 100644
--- a/test/lua/unit/regxep.lua
+++ b/test/lua/unit/regxep.lua
@@ -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