procmail
[Top] [All Lists]

Re: Trouble with multi-line MATCH

2000-02-17 10:08:35
Ralph SOBEK <sobek(_at_)irit(_dot_)fr> writes:
      Thanks a lot for your comments!  From what you say, is 
"word1 *($ *)?word2" always more efficient that "word1 *$? *word2" ?

Yes.  Just think how many ways those regexps can match the line
        word1     word2

The first can only match it one way (all five spaces eaten by the first
" *") while the second can match it six different ways (the first " *"
eating from zero to five spaces and the second eating the rest).  The
regexp engine has to keep track of all of those possibilities.


In both cases the inituai " *" takes as many spaces as possible,
right?

Not really.  For the first regexp, yes, because it has to.  For the
second regexp, if this is on the right-hand side of a \/ token then yes.
If it's on the left-hand side of a \/ (or there isn't one in the regexp)
then no, the first " *" will take as few spaces as possible.  If you
put a \/ directly on either side of the "$?" then you'll get the same
behavior and MATCH will show it.  (Unless that triggers the "wrong start
of match" bug, which it just might given the conditions involved.)


Philip Guenther