procmail
[Top] [All Lists]

RE: rule to catch a certain number of characters

2007-05-27 12:27:40
Bart Schaefer wrote Sunday, May 27, 2007 5:56 PM:

On 5/26/07, Dallman Ross <dman(_at_)nomotek(_dot_)com> wrote:

But 100,000 chars is a lot to capture, and implies a big 
LINEBUF and thereby a big memory footprint.

Just to clarify -- it won't have anything to do with LINEBUF 
unless you interpolate the capture (e.g. by using $MATCH).  
Procmail is likely to have already slurped the entire message 
into memory at some point during the body scan so the length 
of that particular line is not of much extra consequence.

Since you know the long line is in the HTML title tag:

:0:
* B ?? <title>\/.*</title>
* 1^1 MATCH ?? > 1000
spampile

But isn't that use of MATCH going to require LINEBUF?

In any case, the later solution seems fine to me --
1000 or so chars is plenty for a title to prove itself
to be bogus, with or without spces.

Oh: his sample had the format like so:

<title>
[string of 100,000 chars]
</title>

I had 

  * B ?? ()<title>^*\/.*$*</title>

at one point, or something like that, to take care
of the possible newlines.

In my tests, though, it was significantly faster
not to capture such a long string and count it.
Maybe I'm not thinking about this correctly?

Btw, I think you need to quote the "<" that immediately
follows "??" in your line, because otherwise it becomes
an operator.  I could double-check, but am short on time
right now.

I'm not sure that would work if you didn't know some way to 
pick out the specific line that you want to stuff into MATCH. 
 That is, you could try:

:0:
* B ?? ()\/^.*$
* 1^1 MATCH ?? > 9998
whatever

but I've forgotten whether procmail will retry the MATCH 
condition for every success of the B condition.  I think not.

I also think not.

Thanks, Bart.


____________________________________________________________
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