Florian Frank wrote:
> On 2003-08-23 03:18:26 +0900, Andreas Schwarz wrote:
>> def wrap(s)
>>   return s.gsub(/.{1,74}(?:\s|\Z)/){($& + 5.chr).
>>     gsub(/\n\005/,"\n").gsub(/\005/,"\n")}
>> end
>> 
>> Any hints how I can change the function so that it doesn't touch lines
>> with quoting characters (">", "|") in the beginning?
> 
> This should do the job:
> 
> def wrap(s)
>   return s.gsub(/^[^>|].{0,74}(?:\s|\Z)/){($& + 5.chr).
>     gsub(/\n\005/,"\n").gsub(/\005/,"\n")}
> end

No, it doesn't, but I've found this solution:

def wrap(s)
  s = s.gsub(/.{0,74}(?:\s|\Z)/){($& + 5.chr).gsub(/\n\005/,"\n")}
  return s.gsub(/((\n|^)[>|\s]*[>|].*?)\005/, "\\1").gsub(/\005/,"\n")
end

Andreas

-- 
AVR-Tutorial, ?ber 350 Links
Forum f?r AVRGCC und MSPGCC
-> http://www.mikrocontroller.net