How can I make Procmail match an email address which always has 4 numbers in it?
e.g.
[email protected]
I have read that procmail does not support the modern extended regular expression implementations of repetition, such as
^To:.[0123456789]{4}@mydomain.com$
So how else would I do it?
Thanks.
If you cannot use limiting quantifiers, just repeat the pattern:
[0-9][0-9][0-9][0-9]@mydomain[.]com
This will match 4 digits followed by @domain.com
. Note that the .
must be either escaped or put into a character class to match a literal dot (a .
matches any character but a newline).
To match a string that starts with To:
, followed with any character but a newline and followed with the 4-digit username email, use
^To:.[0-9][0-9][0-9][0-9]@mydomain[.]com
See more details on Procmail regex here.