procmail
[Top] [All Lists]

Re: regex syntax question

2004-03-19 07:28:32
On Thu, Mar 18, 2004 at 03:30:37PM +0100, Ruud H.G. van Tol wrote:
Toen ik Ruud H.G. van Tol kietelde, kwam er dit uit:

Dallman Ross:
That regex will trip the 'Exceeded LINEBUF' message,
now and then. A better way puts at most 1000 bytes
(for example) of the body into B_chunk.

  MAXINT = 2147483647
  :0
  *      -1000^0
  * $  $MAXINT^0
  *          1^1  B ?? ^^\/(.*$?)*
  { B_chunkB = $MATCH }

Real nice.

I have to withdraw that.

  MAXINT = 2147483647
  zz = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
  :0
  *      -10^0
  *$ $MAXINT^0
  *        1^1 zz ?? ^^\/.*
  { zz_Top = $MATCH }

does not do what I interpreted that your technique would.

Crap.  You're right.  It's flawed.  I think I see why,
though I don't yet see why it gives the results it does.



There is (1.a) no 'real nice' way to match the first N bytes 
of a buffer, you must (1.b) create a var that holds N dots 
first (which I know is (2) trivial to do).

So please proof me wrong on (1).

Yes, building a var seems to be the way to go.

  ANYCHAR    = "(.|$)?"
  ANYCHAR2   = "$ANYCHAR$ANYCHAR"       ANYCHAR    # 'shroom 'em out
  ANYCHAR4   = "$ANYCHAR2$ANYCHAR2"     ANYCHAR2   # 'shroom 'em out
  ANYCHAR8   = "$ANYCHAR4$ANYCHAR4"     ANYCHAR4   # 'shroom 'em out
  ANYCHAR16  = "$ANYCHAR8$ANYCHAR8"     ANYCHAR8   # 'shroom 'em out
  ANYCHAR32  = "$ANYCHAR16$ANYCHAR16"   ANYCHAR16  # 'shroom 'em out
  ANYCHAR64  = "$ANYCHAR32$ANYCHAR32"   ANYCHAR32  # 'shroom 'em out
  ANYCHAR128 = "$ANYCHAR64$ANYCHAR64"   ANYCHAR64  # 'shroom 'em out
  
  :0
  * $ B ?? ^^\/$ANYCHAR128
  { B_head = $MATCH     ANYCHAR128  # 'shroom 'em out }
  
-- 
dman

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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