From: Igor Pirnovar Date: 2009-02-11T03:15:04+09:00 Subject: Re: regexp problem Rick Denatale wrote: > On Tue, Feb 10, 2009 at 3:19 AM, William James wrote: > > As 7Stud pointed out, a toolbox with only regular expressions > inside is often a poor choice for dealing with xml/html > > Here's a rather verbose and commented program using a > combination of hpricot and a regular expression to do > something like what I think you are looking for: > > require 'rubygems' > require 'hpricot' > . . . > > When run this outputs: ["123313"] > > In other words it produces an array of strings representing > the target numbers in a script tag within a td tag which > follows another td tag whose inner text is "Traffic left:" Rick, your solution is swell, and it is probably worth while considering by someone whose day job is parsing html/xml documents. However, purely from a language and/or from a programmer's perspective William's solution is far more appealing, much shorter, easier to understand and requires virtually no additional learning effort. It nullifies or "flattens" the comment started out by 7Stud that you also elevated to an undeserving height. -- Posted via http://www.ruby-forum.com/.