From: 7stud -- Date: 2007-10-20T03:13:40+09:00 Subject: Re: simple code Ben Giddings wrote: > On Oct 19, 2007, at 09:45, angel.of.north@googlemail.com wrote: >> while line = gets >> md=re.match(line) >> if md =~ nil > > Try "if md.nil?" instead. > if md #do stuff >> else >> puts md > > puts md, md.post_match > puts line Try this: re=Regexp.new('^\s+[A-Z]') #match start of line only ... ... while line = gets md=re.match(line) if md puts line end end -- Posted via http://www.ruby-forum.com/.