I am attempting to write a filter that matches the regex ^[a-zA-Z0-9_.+-]+@(?:(?:[a-zA-Z0-9-]+\.)?[a-zA-Z]+\.)?(example)\.com$. (I want to capture every email that is from a specific domain). However, it keeps returning the error Invalid preceding regular expression. The expression works correctly so I am unsure why this error is occuring. This is the first time I've written a sieve filter so am I missing something?
1
votes
1 Answers
1
votes
You may use
^[a-zA-Z0-9_.+-]+@(([a-zA-Z0-9-]+\.)?[a-zA-Z]+\.)?(example)\.com$
It appeas that the regex should comply with the POSIX ERE regex syntax that does not allow non-capturing groups.
So the solution was to replace all (?: with ( in this regex.
^[a-zA-Z0-9_.+-]+@(([a-zA-Z0-9-]+\.)?[a-zA-Z]+\.)?(example)\.com$- Wiktor Stribiżew