procmail
[Top] [All Lists]

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

2005-01-08 16:21:11
Toen wij Dallman Ross kietelden, kwam er dit uit:

  var = 'xxxxxx6xxx6xxx6xxxx'

  :0
  *  1^1 var ?? .
  * -2^0
  {
    rep_Repeat = "$="
    rep_String = '.'

    INCLUDERC = 'inc/rep.inc'   # rep_Return becomes 17 dots

    :0
    *$ var ?? ^^\/$rep_Return
    { var_Left = "$MATCH" }

    :0
    * var ?? ()\/..^^
    { var_Right = "$MATCH" }

  }

Not bad.  I think it still doesn't need to be so complicated.
Here is my solution.

AFAIS, that is basically the same solution. But with a run of 
x's you can't split another string. :)

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).

-- 
Grtz, Ruud

____________________________________________________________
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