procmail
[Top] [All Lists]

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

2005-01-08 14:04:59
Toen wij Ruud H.G. van Tol kietelden, kwam er dit uit:
Toen wij Robert Allerstorfer kietelden, kwam er dit uit:

deleting 2
characters from the end is nearly impossible without forking an
outside process".

That remark is about strings like "xxxxxx6xxx6xxx6xxxx".

Check out the various uses of rep.inc on how to create regexes that
can do exactly what Jari names 'nearly impossible'.

  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" }
  }

(untested)

That last recipe should be:

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

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