procmail
[Top] [All Lists]

Re: Searching for single word

2002-12-30 12:27:44
At 18:56 2002-12-30 +0100, poff(_at_)sixbit(_dot_)org wrote:
I have a suggestion, but it's probably a BAD way of doing it - but HEY! It
will work ;)
[snip]

Agreed, it's a BAD way of doing it.  It goes back to that efficiency thing.


Mike showed only a condition line, not the whole recipe. I'm not sure he actually included flags:

:0B
* ()\<foo\>
matched.mbx

His original had the empty parens, but for those unaware, they're necessary to escape the slash at the beginning of the regexp (used as part of the "\>" operation, which is "word break").

As to the originally profferred recipe, the parens around "foo" are unnecessary, since it wasn't a unit which was being operated on by a count flag (?/+/*) and did not comprise an OR operation. Also, unless you're trying to obtain the matched text (why would you if there's only one message text?), the match operator "\/", is unnecessary.

In the variation he provided, he gave "*(foo|FOO)*". The preceeding asterisk is incorrect unless you're trying to match zero or more leading spaces (the expression preceeding the wildcard count flag), and the trailing asterisk means zero or more of the preceeding expression - zero or more "foo". The alternate casing of the text is meaningless unless you have the case sensitivity flag active for the given recipe (procmail conditions are by default CASE INSENSITIVE - see the manpages).


Some pointers:

        * Set up a sandbox for testing (see my .sig)

        * Use a controlled message for a test - a message which you've
        edited and know contains the text which you're trying to match.  MAKE
        SURE YOU'RE NOT TRYING TO MATCH AGAINST TEXT IN HTML, WHICH MAY BE
        ESCAPED OR ENCODED.  Just because you see the text in your mail client
        doesn't mean that it appears as plaintext within the message.

        * Enable verbose logging and review your test logs.

---
 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>