procmail
[Top] [All Lists]

Re: Getting partial matches from a string without forking an outside process

2005-01-08 16:34:02
On Sun, Jan 09, 2005 at 12:07:19AM +0100, Ruud H.G. van Tol wrote:
AFAIS, that is basically the same solution. But with a run of 
x's you can't split another string. :)

Yeah, but you were bothering to save the right-hand string,
and then were iterating to create the number of dots, and
then matching the dots against the start of the string.
I don't see any need to save the right-hand part.  What for?
And as long as we're iterating, let's just accrete letters
from the left instead of making dots.

My rep(_fast).inc is more general than your lop.inc, because it can 
also be used to concatenate 200 times 'abcde' or whatever.
rep_fast does that in just 8 iterations (because 200 is about 2^8).

I see.  Yes, that makes sense.  I'm thinking of this for short
strings, though.  But -- yeah, nice.

Btw, we don't even need $LEN in mine.  Here it is even shorter:

########## start main.rc ##########
 :0
 *       1^1 FOO ?? .
 *       1^0
 * $ -$LOP^0
 { INCLUDERC = lop.rc }

 FOO = "$BAR"

########### end main.rc ###########



########### start lop.rc ##########
 :0
 * $ $=^0
 *   -1^0  FOO ?? ^^\/.
 { BAR = "$BAR$MATCH"   SWITCHRC = $_ }

############ end lop.rc ###########

-- 
dman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail