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?
Asked
Active
Viewed 243 times
1

RHPT
- 2,560
- 5
- 31
- 43
-
Try `^[a-zA-Z0-9_.+-]+@(([a-zA-Z0-9-]+\.)?[a-zA-Z]+\.)?(example)\.com$` – Wiktor Stribiżew Apr 15 '20 at 22:09
-
@WiktorStribiżewThat worked! Thank you. What was the issue with my original expression? – RHPT Apr 16 '20 at 13:08
1 Answers
1
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.

Wiktor Stribiżew
- 607,720
- 39
- 448
- 563