procmail
[Top] [All Lists]

Re: fun with regex (or: why is it so?)

2002-08-07 19:20:12
The feline mewed,

| I have the following line in a piece of spam:
|
| To opt out:
|
| And the following regexp with which to match it:
|
| * 3^0 \<opt[-_ ]?out:?\>

Leading backslash conundrum.  If the first character in a procmailrc regexp is
a backslash, its only meaning is "end of whitespace, next character starts
regexp"; if you're trying to use it to mean "reverse the default magic status
of the next character," it won't do that.  Your backslash is telling procmail
that the less-than sign is a literal in a regexp and isn't introducing a size
condition.

This would work:

  * 3^0 \\<opt[-_ ]?out:?\>

but since we expect "\\" to match a literal backslash in the text, it is
highly counterintuitive.  Most people handle it this way:

  * 3^0 ()\<opt[-_ ]?out:?\>

The empty pair of parentheses makes sense to both procmail and humans.



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