Robert Klemme <shortcutter / googlemail.com> wrote:

> There's also the flip flop operator:
> 
> File.foreach "myfile" do |line|
>    if /pattern/ =~ line .. false
>      puts line
>    end
> end
> 
> The trick I am using is that the FF operator starts to return true if
> the first expression returns true and stays true until the last 
> expression returns true - in this case never since you want to read 
> until the end of the file.

coud that trick be used for start and stop tags ? like :

File.foreach "myfile" do |line|
   if /<body/ =~ line .. /<\/body/ =~ line
     puts line
   end
end

if true, that's clever !
-- 
 La vie  ne se comprend que par un retour en arrie, 
   mais on ne la vit qu'en avant. 
   (Sen Kierkegaard)