Invalid regex in Mailbox “Mail Filter” | Howtoforge
Name: Test Regex
Source: Subject / Matches Regex
(?i)spamjunk
Action: Delete
Active: Check
When running ispconfig.sh to update it gives this error….
.ispconfig-before: line 18: error: invalid regular expression ‘(?i)spamjunk’ for regex match: invalid preceding regular expression.
.ispconfig-before: error: validation failed.
sievec(root): Fatal: failed to compile sieve script ‘/var/vmail/$DOMAIN/$USERNAME/.ispconfig-before.sieve’
Then when I try to send a mail, none of the filters are applied due to the invalid syntax…
2025-07-08T10:40:30.067099+02:00 server1 dovecot: lmtp($USERNAME@$DOMAIN)<2386636><0PzUA37ZbGjMaiQAw4QwzQ>: Error: sieve: Failed to compile script `/var/vmail/$USERNAME/$DOMAIN/.ispconfig-before.sieve’
As far as I can tell “(?i)spamjunk” should be valid regex syntax to match a word in a subject but case insensitive, if this isn’t the regex that should be used here – please confirm what should be – when running this through chatgpt independently it says that the rule that it generates…
if header :regex “subject” [“(?i)spamjunk”] {
discard;
stop;
}
Should look like this instead…
if header :regex :comparator “i;ascii-casemap” “subject” [“spamjunk”] {
discard;
stop;
}
If that is the case that would need updating from the ispconfig side I believe?
Any help or guidance appreciated, sure I can’t be the first person to encounter this.
Read more here: Source link
