From: Oscar Lok Date: 2006-09-16T00:17:02+09:00 Subject: Re: Need help about Ruby with text file Paul Lutus wrote: > Mike Durham wrote: > > / ... > >>>> 2)I get the result like :- >>>> hh >>> >>> Please explain the circumstances under which you want to get this result. >>> >> He said the text is "in a file" > > I generally don't require newbies to create and then read a file for > demonstration purposes. I prefer my examples to run exactly as posted. > This > avoids the otherwise inevitable "I tried it and it didn't work!"" > replies. > > What this means is the OP needs to explain the circumstances under which > he > wants two "h" character in a row, clearly and unambiguously. Before, > after, > and in between. > > And now, on re-reading his first post, I can't tell whether he got that > result and didn't want it, or didn't get it and wanted it. Or ... got it > and wanted it, and thought he would mention it in passing. Hi,Paul Lutus Thanks for your reply! aabbcc ddeeff gghhii jjkkll 2)I get the result like :- hh * What I would like to do is :- 1) go through each line from the begin 2) compare "hh" each letter on each line 3) found the line number of "gghhii" 4) extract "hh" of it. Thanks! Oscar -- Posted via http://www.ruby-forum.com/.