From: fox foxmaster Date: 2012-04-25T17:49:33+09:00 Subject: Re: if if if statment Lars Haugseth wrote in post #1058261: > On 04/25/2012 09:17 AM, fox foxmaster wrote: >> end >> >> It will only trigger on the first if statment. >> >> I am trying to add say 10 different triggers and add a new line after >> that. >> > > Try using a case statement: > > File.open("destination.txt", "w") do |out| > File.foreach("original.txt") do |line| > out.puts line > line2 = case line > when /REGEX_1/ then "NEW_LINE_1" > when /REGEX_2/ then "NEW_LINE_2" > when /REGEX_3/ then "NEW_LINE_3" > end > out.puts line2 if line2 > end > end > > -- > > Lars Haugseth Hi Lars, That problem is actually solved but I agree that I need to look in to a xml parser but not for this projekt :) This is my "new" prob elsif line =~ /