From owner-freebsd-questions@FreeBSD.ORG Fri Sep 3 21:12:51 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 96FEF10656C9 for ; Fri, 3 Sep 2010 21:12:51 +0000 (UTC) (envelope-from drew@mykitchentable.net) Received: from smtp2.mc.surewest.net (qsmtp.mc.surewest.net [66.60.130.145]) by mx1.freebsd.org (Postfix) with SMTP id 0CD008FC18 for ; Fri, 3 Sep 2010 21:12:50 +0000 (UTC) Received: (qmail 12822 invoked from network); 3 Sep 2010 14:21:10 -0700 Received: by simscan 1.1.0 ppid: 12813, pid: 12815, t: 0.7362s scanners: regex: 1.1.0 attach: 1.1.0 spam: 3.1.7-deb X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on smtp2.surewest.net. X-Spam-Level: * X-Spam-Status: No, score=1.8 required=13.5 tests=RATWARE_GECKO_BUILD autolearn=disabled version=3.1.7-deb X-Spam-CMAE-Analysis: v=1.0 c=1 a=VphdPIyG4kEA:10 a=8nJEP1OIZ-IA:10 a=jDt-9pEAAAAA:8 a=OW5hAIbIZPz45uZ5U_sA:9 a=8Z6o6Fqo6_tKvdNTfCUA:7 a=PWbOD-5iqVu3sS1qIR3DzkQXmBUA:4 a=wPNLvfGTeEIA:10 a=-Bmh7uUyL5QA:10 Received: from unknown (HELO blacklamb.mykitchentable.net) (69.62.230.77) by smtp2 with SMTP; 3 Sep 2010 14:21:09 -0700 Received: from [127.0.0.1] (bigdaddy.mykitchentable.net [192.168.1.3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by blacklamb.mykitchentable.net (Postfix) with ESMTPS id 98E87165803; Fri, 3 Sep 2010 14:12:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mykitchentable.net; s=default; t=1283548363; bh=hqTpgq3U1GSnapNCHh1mqJ1+caLdEevZ4SGddSwJU/c=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=20RcXtTKtUlvGrDdbUILMHGMorn7SUsmRCDCwE+kgnU4ndANmBy2i+8eEcm2mODZ+ Je3+cMYcrBDIcBBjbKJNV/iM9MEtN8cec1LJXlyI6lMs+veFcnIYAyspcSv7rvqk2J 7SKQFYucqDmSarhNKDMa3nJe9SKTRYASLggpSQ9A= Message-ID: <4C8164C7.9000107@mykitchentable.net> Date: Fri, 03 Sep 2010 14:12:39 -0700 From: Drew Tomlinson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 MIME-Version: 1.0 To: Glen Barber References: <4C814262.5060504@mykitchentable.net> <4C814634.1000003@gmail.com> In-Reply-To: <4C814634.1000003@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 100903-1, 09/03/2010), Outbound message X-Antivirus-Status: Clean 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 21:12:51 -0000 Hi Glen, Thank you for your reply. On 9/3/2010 12:02 PM, Glen Barber wrote: > 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". No, I want "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? This is the actual log entry from the example I used in this email: From Announce@email.famous-smoke.com Fri Sep 3 10:11:08 2010 Subject: Another Must-Attend Event at Famous! Folder: /home//Maildir/new/1283533874.95147_0.blacklamb. 8161 procmail: [95164] Fri Sep 3 10:13:05 2010 procmail: Assigning "NL= " procmail: Assigning "LOG= /home//Procmail/famous_smoke.rc" /home//Procmail/famous_smoke.rc procmail: No match on "^From:.[Ff]amous.*[Oo]rder.*famous-smoke.com>$" procmail: No match on "^From:.*famous-smoke.com>$" procmail: Assigning "VERBOSE=OFF" I think my problem is that I was missing a "space" between "*" and "^From:". Your example shows a space and a reply from Brent Bloxam suggests this is the problem as well. I don't quite understand the difference between the two but have made the change and I'll see if it works. I'm also going to hit Google and see if I can understand. Thanks again for your help! Cheers, Drew -- Like card tricks? Visit The Alchemist's Warehouse to learn card magic secrets for free! http://alchemistswarehouse.com