1

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?

RHPT
  • 2,560
  • 5
  • 31
  • 43

1 Answers1

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