procmail
[Top] [All Lists]

Re: what regexps work?

1997-04-10 12:41:00
James L. McGill <fishbowl(_at_)fotd(_dot_)netcomi(_dot_)com> responded to my
respnse to Philip Guenther <guenther(_at_)gac(_dot_)edu>:
Thank you for your message.

I am wondering which of us you are thanking.

I'd really like to see, for version 4 for example,
true backreferences, instead of the uninteresting $MATCH  \/

In a strict mathematical sense, backreferences are not a part
of regular languages and hence regular expressions. They also
force the use of an NFA engine, which is less efficient for
large blocks of test than a DFA. DFA's require more complex
regexp compiling, I don't know at what quantity of text the
faster processing offsets that. If one assumes that headers
will be most of the text scanned, than you can assume small
quantities of text. I have not RTFSed procmail, I don't
know what it uses.

construction.  I would not expect a full perl implementation
but why couldn't procmail actually use egrep or something?

Forking a seperate process is much slower. Grabbing regexp
libraries from Gnu egrep on the other hand....

Perhaps I am missing something fundamental... is there an
easy way to *use* perl or egrep instead of the * line in 
a recipe?
 
This works:

        :0:
        * ? perl -w /path/to/script
        $JUNK

I can't get this to work, though:

        :0:
        * ? perl -e ' \
        $val=0; \
        while (<STDIN>) { \
         if ( /^$/ ){ $val && exit 0; exit 1; } \
         $val += /^From:.*[ <]([^\(_at_)]+)\@(\1|[^.]{13,})\.(com|net)([ 
]|$)/i; \
        } '
        $JUNK

Somewhere along the way something seems to be doing varible
interpolation on it.

Elijah
------
please do not CC me when replying to the list

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