procmail
[Top] [All Lists]

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

2005-01-09 21:21:40
Toen wij Bart Schaefer kietelden, kwam er dit uit:

it does not work when $leftpart contains an embedded newline.  It
appeared (at the time) that what happens is that $\leftpart causes the
newline to be prefixed with a backslash, which when parsed again by
the regex engine is then recognized as a line continuation, causing
the newline itself and any whitespace that follows it to be ignored.

Just change two lines in the script that I just published
(the non-INCLUDERC-ing string-splitter)

Change the line
  d0 = '.'       d1 = '..'      d2 = '....'    d3 = '$d2$d2'  # 15
to
  d0 = '(.|$)'   d1 = '$d0$d0'  d2 = '$d1$d1'  d3 = '$d2$d2'  # 15

and the recipe to get the tail, to:
  :0
  *$ $ $ $ $ $ $  Str ?? ^^$s\/(.|$)*
  { Str_Right = "$MATCH" }


The multiple-parsing of the condition-line is mainly for
fun, and can be removed if the quotes of d1 = '$d0$d0'
(and its children) are changed to dquotes (but then the
variables take a lot more space).

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

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