procmail
[Top] [All Lists]

Re: Problem with MATCH?

1998-01-02 16:49:56
Justin Lloyd wrote,

| I am having a problem with a recipe using MATCH.  I get emails with the
| subject
| 
|    Subject: H/W difference report for HOSTNAME
| 
| where HOSTNAME is the name of some computer.  ...  I only want to see these
| reports from certain programs, so I tried the following:
| 
| :0
| * ^Subject: H/W difference report for \/[^ ]+
| {
|    :0:
|    * MATCH ?? (su|sg|hp|al)w[123](isd|svr|ipl|aip|gpc)[0-9]+
|    $DEFAULT
| 
|    :0
|    /dev/null
| }

| However, reports from machines whose names don't match the regex are getting
| through.  Any ideas about this?

Do the names of the machines whose reports you don't want to read have sub-
strings that match the regexp?  Perhaps you need to anchor it leftward and
rightward:

   * MATCH ?? ^^(su|sg|hp|al)w[123](isd|svr|ipl|aip|gpc)[0-9]+^^

Beyond that, we'd need to see examples [preferably with a piece of verbose
logfile] to figure the problem out.  I doubt that the problem is with the
MATCH facility, but what happens if a message that should not have gotten
through but did is put up against this code?

  :0:
  * ^Subject: H/W difference report for \
    (su|sg|hp|al)w[123](isd|svr|ipl|aip|gpc)[0-9]+
  thank_you
  :0E:
  * ^Subject: H/W difference report for
  who_cares

If that works where your original code does not, then either extraction or
brace nests are failing for you, I'd guess.  Another possibility is that
reports for other machines don't match "H/W difference report for" at all,
so procmail doesn't enter the braces and it delivers those reports to
$DEFAULT just by falling off the end of the rcfile.  (Hint: at least while
you're testing, save the reports that you want to a folder other than
$DEFAULT.)

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