procmail
[Top] [All Lists]

Re: what regexps work?

1997-04-11 10:57:00
On Fri, 11 Apr 1997 15:28:50 +0300 (EET DST), I wrote:
On Thu, 10 Apr 97 15:24 EDT, 
process(_at_)qz(_dot_)little-neck(_dot_)ny(_dot_)us 
(Eli the Bearded) wrote:
:0:
* ? perl -e ' \
$val=0; \
while (<STDIN>) { \
if ( /^$/ ){ $val && exit 0; exit 1; } \
$val += /^From:.*[ <]([^\(_at_)]+)\@(\1|[^.]{13,})\.(com|net)([ >]|$)/i; \
} '
$JUNK
I tried this exactly as shown and had no problem executing it. 
According to the verbose log, what is being executed is precisely
the script as written above. 

(However, it could be simplified quite a bit, to the extent that it no
longer contains any dollar signs for anything to interpolate, if that
is the problem [Eli indicated in private mail that this is happening
with his setup but it seems to be a shell or Perl version thing]:

    :0:
    * H ?? ! ? perl -ne 'exit 1 if \
      m/^From:.*[ <]([^\(_at_)]+)\@(\1|[^.]{13,})\.(com|net)([ >]|$)/i'
    $JUNK
                                            (oops, one left) ^
The H ?? says to pass only the header to Perl, thus simplifying the
Perl script into a one-liner. The ! inverts the meaning of the exit
code, i.e. exit 1 means, in the end, a successful match.
  Of course, if the interpolation problems are munging the actual
regexp, you are out of luck. [There's still one dollar character, for
one thing. Try escaping it ...]

BTW, does setting SHELL=/bin/sh at the beginning of your .procmailrc
change things at all?)

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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