procmail
[Top] [All Lists]

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

2005-01-08 13:45:46
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)

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