procmail
[Top] [All Lists]

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

2005-01-09 03:03:51
On Sat, 08 Jan 2005, 23:31 GMT+01 Ruud H.G. van Tol wrote:

Toen wij Robert Allerstorfer kietelden, kwam er dit uit:

I haven't tested your recipe as well, but my solution will also work
on this string

Right, but if you look into (for example) snr.inc (that you include in
your code) then you will find the split-technique there.

I have added (a slightly modified - as discussed below) your
'snr_fast.inc.inc' to my SoftlabsAV at version 0.6.7, released on
2004-04-11 (as 'av_snr.inc'), used only as a sub routine for
'av_lc.inc', to lowercase strings like 'eXE' to 'exe'.

However, I cannot see the split-technique I am using in my
'av_split.inc' in your snr_fast. What I needed in SoftlabsAV 0.8.3 was
a pure-procmail solution working similar to perl's 
substr($av_SPLIT_STRING, $av_N)
function. Thus, I wrote this, "from ground".

Something else:

You have replaced rep.inc with your av_cat.inc inside av_snr.inc, which
is OK since they basically do the same (repeat a string a number of
times).

Yes because I had my own routine to concatenate a string multiple
times ('av_cat.inc') in use since 2004-03-20 (SoftlabsAV 0.6), at a
time your rep.inc did not exist.

For higher numbers it really pays off to use rep_fast.inc, because
it needs far less recursions. This can be tested wit rep_fast_demo.rc
See http://www.xs4all.nl/~rvtol/procmail/ --> archive --> 121.zip

Some results (in repeats:iterations) 10:3, 100:7, 1000:13,
so only double the number of iterations for ten times the number of
repeats.

Sounds good. I don't handle with high numbers of concatenations
however, so my 'av_cat.inc' seems to be sufficient for now.

You use snr.inc to replace '_' by ' ', where xlt.inc is more efficient
for single-character-translations, but I guess that you already know
that.

Yes, and the reason is that I already had your snr_fast integrated in
my package, and xlt was not available when I needed that
functionality. It still seems experimental to me (at least it is not
documented well), so I keep using the "old and stable" version for
now.

cheers,
rob.


____________________________________________________________
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