From: 7stud -- Date: 2008-03-26T15:41:41+09:00 Subject: Re: sorting text in a file Adam Akhtar wrote: > The details are a bit trickier as some spill onto a second line (but > seperated by a blank line). Then you should have posted an example file with all the possibilities. > Second am i going about this the write way. S > Probably not. > Should I have just avoided > regex and simply read the file line by line using if structures to > figure out which lines are with which event??? > That is one way. On the website, the information is probably contained in different html tags. So scraping the website, then joining all the data together, then trying to separate the data is not a good plan. You should be able to pick the pieces from the website directly. However, you have to know html is written and how it is structured. Ruby has several gems, e.g. Hpricot, that make it easy to pick out pieces of information on a website, but you sort of have to know how html in order to pick out the data you want. If that sounds too confusing, then just deal with the text file you have, and YES you should avoid regex's whenever possible. So reading the file line by line would be much easier. -- Posted via http://www.ruby-forum.com/.