procmail
[Top] [All Lists]

Re: Help with multi-line matching.

2007-06-06 10:20:34
On Wed, Jun 06, 2007 at 09:17:44AM -0700, Ray Van Dolson wrote:
I have tried a number of different recipes to match on this, and am
currently using the following:

:0
* ^List-Id: .*$^[        ]*<fedora-devel-list.redhat.com>
${MAILDIR}.fedora-devel-list/

Procmail unfolds header lines automatically.  You are never going
to match on a header with two, let alone one, linefeeds in it.
(Both $ and ^ represent linefeeds in your condition.)

I suspect your "^[      ]" was intended to be "[^       ]":
"Neither a space nor a tab."  Syntax does, of course, matter.
But even if you fix that (and remove the "$"), well,

   [^   ]*

means "zero or more instances of neither a space nor a tab."
Which, in turn, reduces to nothing at all.  (Procmail is
natively stingy with regexes; see yesterday's threads on this.)

When you get stuck, the easiest way to troubleshoot is usually
to fall back on something simple that you know works, and then
build up from there.  E.g., you could try (and it would work):

  * ^List-ID:.*fedora-devel-list

Then you could add phrases or statements one at a time testing
each one to be sure it works.

Does the List-ID header really have "<" and ">" around the list
name?  Those *are* real angle-brackets to procmail, you need to
realize.  (Not so with "\<" and "\>", however, which are procmail
tokens and described in the man pages.)

The other thing to remember is to look at your logs when troubleshooting,
and post excerpts with your trouble report.

Your dots in the list name ought to be quoted so that they do
not overmatch, since "." means "any single character."

Here's what I'd do:

  :0
  * ^List-Id:(.*\<)?fedora-devel-list[.]redhat[.]com\>
  ${MAILDIR}.fedora-devel-list/

Or even:

  :0
  * ^List-Id:(.*\<)?\/[a-z-]+[.]
  * MATCH ?? ^^\/[a-z-]+
  $MAILDIR.$MATCH/

to match automatically on various lists with similar syntax.


Inside the [] I have a single tab character and a space.  I've
also tried using [[:space:]]* in its place as well, along with

Will never work in procmail.

Isn't the $^ at the end of my intial List-Id pattern enough to
designate a newline?

It's enough to designate TWO newlines (or linefeeds), and is
your main problem.  There should be none.

Dallman
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>