Regex Help For Procmail
Drew Tomlinson
drew at mykitchentable.net
Wed Sep 8 16:22:37 UTC 2010
On 9/7/2010 5:50 PM, Robert Bonomi wrote:
>> From owner-freebsd-questions at freebsd.org Mon Sep 6 12:46:59 2010
>> Date: Mon, 06 Sep 2010 10:46:47 -0700
>> From: Drew Tomlinson<drew at mykitchentable.net>
>> To: perryh at pluto.rain.com
>> Cc: frank at shute.org.uk, freebsd-questions at freebsd.org
>> Subject: Re: Regex Help For Procmail
>>
>> On 9/5/2010 4:02 PM, perryh at pluto.rain.com wrote:
>>> Frank Shute<frank at shute.org.uk> wrote:
>>>
>>>> Drew, try this:
>>>>
>>>> * ^From:.*famous-smoke\.com
>>>>
>>>> I think it's not catching it because the period isn't backslash
>>>> escaped ...
>>> Unless there's some edge case that I'm not thinking of, adding a
>>> backslash to escape a period will never convert a non-match into
>>> a match. An unescaped period in an RE matches any character,
>>> including a period. An escaped period matches only a period.
>> I have confirmed this. I did add the backslash but procmail is still
>> not matching.
>>
>>> Adding the backslash _does_ better represent what the OP wants
>>> to accomplish, but the lack of it is not the cause of the RE not
>>> matching. (I'm not sufficiently familiar with how procmail uses
>>> REs to figure out what _is_ causing it not to match.)
>> True and thus I'll leave the backslash. However I have no idea what
>> _is_ causing it not to match either. I'm stumped.
> Chances are you're 'over-specifying' what you want. take off the trailing
> $, and maybe even the '>'
>
> There's _something_ in the header that is not what you 'think' it is,
> which is what is causing the problem. the difficulty is -finding- what
> that 'something' is.
>
> From whatever file procmail is dumping that message into, try using a
> minimal text editor (something that is *NOT* language/charset aware,
> delete everything _but_ that 'From: ' line, and then use that as input
> to 'od -xc' to see _exactly_ what's there.
>
Here is that output:
blacklamb> od -xc x
0000000 7246 6d6f 203a 4622 6d61 756f 2073 6d53
F r o m : " F a m o u s S m
0000020 6b6f 2065 6853 706f 2022 413c 6e6e 756f
o k e S h o p " < A n n o u
0000040 636e 4065 6d65 6961 2e6c 6166 6f6d 7375
n c e @ e m a i l . f a m o u s
0000060 732d 6f6d 656b 632e 6d6f 0a3e
- s m o k e . c o m > \n
And this procmail recipe does *not* match:
# Deliver other email to folder
:0
* ^From:.*famous-smoke\.com
"${HOME}/Maildir/.Shopping/Famous Smoke/Email/"
Do you see anything I'm missing?
Thanks,
Drew
--
Like card tricks?
Visit The Alchemist's Warehouse to
learn card magic secrets for free!
http://alchemistswarehouse.com
More information about the freebsd-questions
mailing list