From: Peter Szinek Date: 2006-12-19T18:17:04+09:00 Subject: Re: Hpricot and Regular expression Dhanasekaran Vivekanandhan wrote: > Hi All, > I have a html fragment like the following > > Toon Zone News1 > Toon Zone News2 > Toon Zone News3 > Toon Zone News3 > > I want to match only the first three anchor tags, I dont want to get the > last one since the href f parameter is abcd.it is not an integer. I want > to get only if the request parameter is integer.i.e. the first three > anchor tags. Try result = (Hpricot(html)/"a[@href]").map.reject { |elem| elem.attributes['href'] !~ /=\d+$/ } HTH, Peter __ http://www.rubyrailways.com