procmail
[Top] [All Lists]

Re: whitespace regex

2001-10-26 15:02:48
At 16:13 2001-10-26 -0400, S. Morgan Friedman wrote:
thanks for your help! however, i just tried your two main suggestions:

* ^Subject:.*      [0-9]+

and

* ^Subject:.*[^ ]*.*      [0-9]

and neither worked (when i send an e-mail with 7+spaces then a number in the subject line, it just sorts it into my inbox as it does regularly).

I should make a correction to my original post. The asterisk trailing in "[^ ]*" should be removed, making it "[^ ]", otherwise, ZERO or more would match, and the rule would not have required a non-space character before matching the run of spaces. My bad -- but this has NOTHING to do with the failure you're having.

You *ARE* putting these match conditions into a recipe context, right?

:0:
* ^Subject:.*[^ ].*      [0-9]
whitespace_spam


FTR, it'd help if you provided a snippet from your VERBOSE logfile showing the regexp, result, and the subject line. The VERBOSE logfile should be one of the FIRST things you check even before posting an inquiry to this list -- it'll frequently point out that you're doing something glaringly stupid.

Also, if you're sending test messages from some client app, there may be character encodings in the subject which cause the string not to match -- the VERBOSE log would better identify what the ACTUAL message contained.

did you test these our on yours before you sent them?

        1. as per my .sig, everything is provided as-is without warranty.

        2. I just so happened to test this before posting, and it did work as
        advertised.  Here again, you might want to chec the URL in my .sig and
        note the sandbox method of testing filters.

are you positive they work on your system?

Yes, but then I'm not using this in an active filter, I just churned out a test for your benefit.

Here's the pertinent chunk of the VERBOSE logfile from my test:

procmail: Assigning "INCLUDERC=test_filter.rc"
procmail: Match on "^Subject:.*[^ ]*.*      [0-9]"
procmail: Locking "test.matched.lock"
procmail: Assigning "LASTFOLDER=test.matched"
procmail: Opening "test.matched"
procmail: Acquiring kernel-lock
procmail: [11870] Fri Oct 26 14:33:35 2001
procmail: Unlocking "test.matched.lock"
From testmessage(_at_)testdomain(_dot_)tld  Sat Jun 30 10:34:44 2001
 Subject: You're Invited...      02835 help

All I have to do to test the filter is edit a message to have the desired attributes and process it through procmail manually:

        procmail -m testing.rc < test.msg

I can tweak the test message in different ways (add more spaces, add/remove trailing text, etc), and pipe it through again and see the results. The above is with the minimum SIX spaces (those are SPACES, not tabs, pursuant to the explanation in my previous message).

I get the same result with additional spaces, but if I drop the space count to 5 or less, I get:

procmail: Assigning "INCLUDERC=test_filter.rc"
procmail: No match on "^Subject:.*[^ ]*.*      [0-9]"
procmail: Assigning "LASTFOLDER=/dev/null"
procmail: Opening "/dev/null"
From testmessage(_at_)testdomain(_dot_)tld  Sat Jun 30 10:34:44 2001
 Subject: You're Invited...     02835 help
  Folder: /dev/null

Here's the log from a subject matching your described scenario:

procmail: Assigning "INCLUDERC=test_filter.rc"
procmail: Match on "^Subject:.*[^ ]*.*      [0-9]"
procmail: Locking "test.matched.lock"
procmail: Assigning "LASTFOLDER=test.matched"
procmail: Opening "test.matched"
procmail: Acquiring kernel-lock
procmail: Unlocking "test.matched.lock"
From Shayes01(_at_)sprynet(_dot_)com  Sat Jun 30 10:34:44 2001
 Subject:       7

Seems to be working just as advertised (this last example WOULDN'T match if the regexp is updated as indicated at the top of this message - because the run of spaces has no other character preceeding it). It would help if you clearly defined EXACTLY what subject line you're throwing at it instead of talking in vague terms.

[snip - BIG snip -- please don't send the entire previous message back, it's a waste of bandwidth]

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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