]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Simplify parse_sa_regexp by delegating to rspamd_regexp.create
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 26 Jan 2026 17:48:55 +0000 (17:48 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 26 Jan 2026 17:48:55 +0000 (17:48 +0000)
Remove unnecessary flag parsing and inline modifier transform that
caused issues with invalid PCRE flags (g, u). rspamd_regexp.create
already handles /pattern/flags and m{pattern}flags formats natively.

Closes: #5858
src/plugins/lua/multimap.lua

index 4510d00178c47d4ff76a90bb1034279c16637cf2..c753858d9098d89eb95721a6cfa6ffc79fed247f 100644 (file)
@@ -131,22 +131,7 @@ local function split_sa_line(str)
 end
 
 local function parse_sa_regexp(rule_symbol, re_expr)
-  -- Extract regexp and flags from /regexp/flags format
-  local re_str, flags = string.match(re_expr, '^/(.+)/([gimxsiu]*)$')
-  if not re_str then
-    re_str, flags = string.match(re_expr, '^m{(.+)}([gimxsiu]*)$')
-  end
-  if not re_str then
-    -- Try without delimiters
-    re_str = re_expr
-    flags = ''
-  end
-
-  if flags and flags ~= '' then
-    re_str = '(?' .. flags .. ')' .. re_str
-  end
-
-  local re = rspamd_regexp.create(re_str)
+  local re = rspamd_regexp.create(re_expr)
   if not re then
     rspamd_logger.errx(rspamd_config, 'cannot create regexp for %s: %s', rule_symbol, re_expr)
     return nil