From owner-freebsd-questions@FreeBSD.ORG Fri Sep 3 19:02:39 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF0CA10656B0 for ; Fri, 3 Sep 2010 19:02:39 +0000 (UTC) (envelope-from glen.j.barber@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7DD8C8FC17 for ; Fri, 3 Sep 2010 19:02:39 +0000 (UTC) Received: by qyk4 with SMTP id 4so2346692qyk.13 for ; Fri, 03 Sep 2010 12:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=KevrpOo19wZYX8OZNSVgg1GvTTDHTB0OzEZv2CQW6EU=; b=GmREoYdBNb5+zA+O66eNLdyW0lvgkMGRFksZUtMS/tZAWNmb69if19YK70eqr34SZS Slkj9V+tLMClaofdlHsm9u5hSNO3Gx0+ldNfo0lAssbP59i/ZM9zZi2ARQ/rPdP85yVj fFk/Y+Ue4KbxACm4pIxBoazJRj10TsqEcJy8o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=bm/hcy/h7+u2AYDHVsudY2D/sozTHNvF6QbdPZbGVsi1Xj0QdATFhpLbfBYcGjl89U n/++OBHeBgz7HOFDs2Me4vxZjPQtym4lGyWdo/fOCT7XChRmFSGTmn2HySuwaaBjFdVQ 4qtgQ9Bu4m+wvCBo8+6f395EON0kvtftuxwis= Received: by 10.229.51.215 with SMTP id e23mr593249qcg.231.1283540536138; Fri, 03 Sep 2010 12:02:16 -0700 (PDT) Received: from schism.local (75.97.128.170.res-cmts.sewb.ptd.net [75.97.128.170]) by mx.google.com with ESMTPS id e6sm2272861qcr.17.2010.09.03.12.02.12 (version=SSLv3 cipher=RC4-MD5); Fri, 03 Sep 2010 12:02:14 -0700 (PDT) Message-ID: <4C814634.1000003@gmail.com> Date: Fri, 03 Sep 2010 15:02:12 -0400 From: Glen Barber User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 MIME-Version: 1.0 To: Drew Tomlinson References: <4C814262.5060504@mykitchentable.net> In-Reply-To: <4C814262.5060504@mykitchentable.net> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Regex Help For Procmail X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2010 19:02:39 -0000 Hi Drew, On 9/3/10 2:45 PM, Drew Tomlinson wrote: > I use procmail for mail delivery and I'm trying to concoct the right > regex to match From: headers and deliver to a folder. However mail is > sent from various addresses so I want to match all that end with > "famous-smoke.com>". Here's an example of a header: > > From: "Famous Smoke Shop" > > Because I also occasionally order, I don't want to catch mail from > anything that has the word "Orders" and "Famous" in the From field. > Thus here is my procmail recipe: > > # Deliver order info to inbox > :0 > *^From:.[Ff]amous.*[Oo]rder.*famous-smoke.com>$ > "${HOME}/Maildir/new/" > Is this supposed to be "match Famous OR Order"? This currently matches "Famous AND Order". > # Deliver other email to folder > :0 > *^From:.*famous-smoke.com>$ > "${HOME}/Maildir/.Shopping/Famous Smoke/Email/" > Going by your examples, you want to catch "Famous OR Order" and place that in Maildir/new, and all other email from this address to go to Maildir/.Shopping/... Try this: # catch "famous" or "order" :0 * ^From:.*([Ff]amous|[Oo]rder).*famous-smoke.com>$ "$HOME/Maildir/new" # catch everything else from this sender :0 * ^From:.*famous-smoke.com>$ "$HOME/Maildir/.Shopping/Famous Smoke/Email/" > According to my procmail log, the From: header does not match. I would > expect the example From: header above to match the second regex and be > delivered to the specified folder. Where is my error? > If my assumption above is incorrect, could you paste a snippet from your procmail log and point out what should be matching so we can have a specific example? Regards, -- Glen Barber