procmail
[Top] [All Lists]

Re: extracting all but three characters

1996-08-25 06:25:41
"Alan K. Stebbens" <stebbens(_at_)sgi(_dot_)com> wrote:
Perl 5 has recently added to its excellent regexp matching primitives
two similar ideas: positive and negative look-ahead assertions (?=PAT) 
and (?!PAT).

The trouble with these extensions is that they wreak havoc on the runtime
behaviour.
The procmail regexp engine currently is the only (to my knowledge) regexp
engine that has a *worst*case runtime of:       K*n
Where K is a constant that varies with the complexity of the regexp and
n is the length of the text we search in.

Most regexp engines exhibit a worstcase runtime behaviour of:   K*n*n
Adding the look-ahead assertions would make procmail's behaviour
change to:      K*n*n
as well (well, only if the lookahead is really performed).

It might be possible to persuede Stephen to add something similar, but

I'll look into it.

then he would have to document the procmail regexp, instead of relying
on egrep :^).

Already started doing that in more recent manuals.

Since "\/" marks the beginning of MATCH, why not make the second
occurance of "\/" mark the end of MATCH?  I'll be that it is not too
difficult to add.

There already is some undocumented behaviour when two \/'s are encountered
in the regexp.  I forgot what happens exactly, though (would have to check
the source).
-- 
Sincerely,                                                          
srb(_at_)cuci(_dot_)nl
           Stephen R. van den Berg (AKA BuGless).

Are they twins?  Yes.  Are they *both* yours?

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