Ryan Davis wrote:
> Many times in regexen like these, you don't need or want greedy matches. 
> Non-greedy is much much faster in many cases
> 
>     <537> time ruby -0 -ne'puts "#{$1.length}, #{$2.length}" if 
> /A(.+?)(\n+?)B/m' str
>     2, 10000

thanks for the tip (strange, i had always thought/heard that non-greedy 
matches are slow... but hey, what do i know?)

i had also fixed my regex in my previous case by avoiding .+ and using 
[^\015\012]+. ruby now processes my data in less than a second too :-)

--
dave