iMelody Ooo wrote: > Dear Brian Candler, thank you very much, but still have problem. > > I read a line from file,want to macth ";" > > f = File.open(filename) > f.each do|line| > puts line > puts line.match( %r{;$}) > puts line.match( %r{;\z}) > puts line.match( %r{(.*);$}) > puts line.match( %r{(.*);\Z}) > end > > result: > ABC DEF=""; > nil > nil > nil > nil then do this f = File.open(filename) f.each do|line| puts line puts "found ;" if line[-1]==";" end -- Posted via http://www.ruby-forum.com/.