Re: Procmail egrep regex problem...

Bart Schaefer <[email protected]> Mon, 08 Mar 2010 11:25:56 -0800
Newsgroups gmane.mail.smartlist.user
Message-ID <[email protected]>
On Sun, Mar 7, 2010 at 3:25 PM, M. G. Devour <[email protected]> wrote:
>
> How do I get the literal ctrl-M into the bracket expression?

Literal ctrl-M is probably not what you want anyway, because during
the SMTP transaction lines are delimited by "\r\n" and by the time
procmail gets the message it probably has been rewritten to have only
"\n" (which is ctrl-J).

Instead you should make use of another procmail oddity, which is that
the $ [end-of-line] marker actually matches a newline character rather
than matching a zero-width boundary as it does in other regex engines
like perl's.

So if you use ([^;]|($))+ you'll match one or more non-semicolon or
newline characters.  The extra parens around ($) are an idiom to
distinguish it from introducing a variable expansion.