From: Paul Lutus Date: 2006-11-25T04:47:39+09:00 Subject: Re: Hpricot - best way to parse based on comments Jerome --- wrote: > I am trying to parse some files that contain comments like this: > > > > > > > images, text, etc... > > > > Interesting text of site here. > > > > > > I am wondering how to go about extracting the data within the comments > block using Hpricot. The best and easiest way to parse this file using Hpricot with your required specification ... is not to use Hpricot. start_mark = "" end_mark = "" data = File.read(page_path) output = data.scan(%r{#{start_mark}(.*?)#{end_mark}}m) All done, finished, no poring over documentation, no considering rewriting the library to get it to do what you actually want, done. By the way. Did I mention that inserting new data into the same page structure is about the same level of difficulty? -- Paul Lutus http://www.arachnoid.com