SPUG: [OT] procmail extended regexp Re: Regular Expression
John Costello
cos at indeterminate.net
Sun Jul 10 21:59:04 PDT 2005
On Sun, 10 Jul 2005, John W. Krahn wrote:
> Yitzchak Scott-Thoennes wrote:
> > On Thu, Jul 07, 2005 at 03:05:10PM -0700, John W. Krahn wrote:
> >
> >>John Costello wrote:
> >>
> >>>On Thu, 7 Jul 2005, Duane Blanchard wrote:
> >>>
> >>>>My favorite online reference is http://www.regular-expressions.info/
> >>>>which covers more material for more environments than I can fathom.
> >>>
> >>>Related to regular expressions, does anyone know of a good discussion of
> >>>procmail's regular expressions? I encountered an odd example (discussed
> >>>earlier this month on LondonPM) in which I wasn't sure if procmail would
> >>>treat $? as an environment variable or an optional end-of-line character.
> >>
> >>You can't use quantifiers with zero-width assertions because they match at a
> >>position in the string not any characters. If you want an optional
> >>end-of-line you have to do something like "($|)" (match end-of-line or nothing.)
> >
> > I know you are responding to a question about procmail regular
> > expressions, but I want to clarify that perl does allow ? or other
> > quantifiers after zero-width assertions (though I think $? will always
> > be treated as a variable interpolation, so you'd have to say (?:$)? ).
>
> Wow. I was surprised to find out that it indeed does work, at least in Perl,
> for example \Z?, \z?, \A?, \b?, etc. You learn something new every day. :-)
I *think* that $? also works in procmail. At least, it doesn't complain.
I haven't had a chance to form a mail message that should be filtered only
if $? is valid as an optional end-of-line.
-----
John Costello - cos at indeterminate dot net
More information about the spug-list
mailing list