I have found a lot of examples for procmail to match on the From: header with wilcards, but I'd like to do an exact match, in order to prevent From:.*[email protected] matching both [email protected] and [email protected]
Is this possible, and if so, how?
The customary procedure is to add word boundary anchors on both sides of the target address.
If you want to match exactly two email addresses and no others, craft a regular expression which will only match those two. In your specific example,
b?jgordon@example\.com
will match bothbjgordon
andjgordon
. A common similar pattern is to want to match bothfirstname.lastname
andflastnam
; a pattern for that would be(firstname\.lastname|flastnam)@example\.com
.I'm a bit confused. You should have a procmail for each user. If you folded them into the same one, that's the problem. Of course, Unix can handle it! Just tell it how to handle it. Keep in mind that it flows down. So you can squash things as they come in. Hook the bjgordon first.
If you want it to survive a rule use the carbon copy rule:
The
.*
is what is matching the additional characters. You only need to match spaces after the header name, so you can change this to*
.I suspect that it may also be possible to anchor the end of the header to avoid matching additional characters at the end, but I haven't tested this myself.