From: Vsevolod Stakhov Date: Mon, 26 Jan 2026 17:48:55 +0000 (+0000) Subject: [Fix] Simplify parse_sa_regexp by delegating to rspamd_regexp.create X-Git-Tag: 4.0.0~172 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cbcff0cc6ce7b4392fcf591167775f39108f5e77;p=thirdparty%2Frspamd.git [Fix] Simplify parse_sa_regexp by delegating to rspamd_regexp.create 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 --- diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 4510d00178..c753858d90 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -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