procmail
[Top] [All Lists]

no match of ^TO(comp\.lang\.)?perl by To: comp.lang.perl.moderated

2001-08-16 06:58:40
I can't see why this To: line 

To:  comp.lang.perl.moderated

doesn't match on this condition
line.

:0
* ^TO(comp\.lang\.)?perl
pl

Here is an abbreviated section from the log. I turned on VERBOSE
just before the recipe and turned it off just after.

procmail: [28417] Thu Aug 16 16:18:13 2001
procmail: No match on "(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparent
ly(-Resent)?)-To):(.*[^a-zA-Z])?)(comp\.lang\.)?perl"
procmail: Assigning "VERBOSE=off"
From clpm-owner(_at_)lists(_dot_)eyrie(_dot_)org Thu Aug 16 08:18:12 2001
 Subject: Re: Pattern matching: are regexes always fastest?
  Folder: /usr/home/lang/Mail/mbox                                         2507

I've never really understood the (.*[^a-zA-Z])? part in the ^TO
macro, but it seems to be saying, Match a string that comes after
the To: and before the string you are looking for. I can't see
what use saying there may be some optional non-alphabetic
characters [^a-zA-Z]? before your string has, if just before that
it says any string, .* will be matched.

Wait, that ? comes after the ), so it is saying an optional
string ending in a non-alphabetic character may proceed your
string. But that is what I have, 2 spaces. 

What am I missing here. Is the fact this is not a full email
address important?

Interestingly when I pipe the message back through procmail -m
.procmailrc, it DOES end up in the pl folder, that is there IS a
match.

I'm attaching the message itself.

-- 
Greg Matheson                All teaching is teaching 
Chinmin College,             under difficult circumstances.
Taiwan                           
--- Begin Message ---
Kai Großjohann <Kai(_dot_)Grossjohann(_at_)cs(_dot_)uni-dortmund(_dot_)de> 
wrote:
A path looks like this:

    /foo[13]/bar[42]/baz[1]/@x
    /a[1]/b[2]

[snip]

So, is there something like regular expressions, except that they
apply to arrays of strings rather than arrays of characters?  Or
should I store each path twice, once as two arrays (for the other
operations) and once as a string (for patch condition matching)?

You might want to do a literature search on "regular path expressions" 
(and just plain "path expressions"); paths similar to yours are used for 
making assertions in certain kinds of fault-tolerant systems, and I think 
there's been some work on matching them efficiently without backtracking 
(since in fault-tolerant systems, the steps represent progressive states 
of the system).  Also, take a look at various XPath processors, since your 
notation is essentially a subset of XPath.

You could fairly easily convert your paths to NFAs and then either convert 
to DFAs or use the standard NFA simulator algorithm.

--- End Message ---
<Prev in Thread] Current Thread [Next in Thread>