On Oct 13, 2006, at 1:55 PM, charles.nadeau / gmail.com wrote:

>     require 'net/http'
>          begin
>               hdoc =
> Net::HTTP.get(URI.parse('http://finance.yahoo.com/lookup? 
> s=Dupont&t=S&m=US'))
>
>               re = /<TD>(.*)</TD>/
>               if hdoc =~ re
>                    print "#{$&}\n"
>               else
>                    print "Nothing\n"
>               end
>          end

Whrn I substitute '\/TD' for '/TD' and make the regex case  
insensitive, I get a match. See below:

<code>
! /usr/bin/env ruby -w
require 'net/http'
hdoc = Net::HTTP.get(URI.parse('http://finance.yahoo.com/lookup? 
s=Dupont&t=S&m=US'))
re = /<TD>(.*)<\/TD>/i ### note changes
if hdoc =~ re
    puts "#{$&}\n"
else
    puts "Nothing\n"
end
</code>

<result>
<td><table border="0" cellpadding="6" width="100%"  
cellspacing="0"><tr><td bgcolor="#556f93"><big><b  
style="color:#ffffff">Symbol Lookup </b></big></td></tr></table></ 
td></tr><tr><td></td></tr></table></td></tr><tr><td><table  
cellpadding="0" border="0" cellspacing="0"><tr><td></td></tr></ 
table></td></tr><tr><td valign="top"><form><table border="0"  
cellpadding="4" bgcolor="a0b8c8" cellspacing="1"><tr><td  
bgcolor="eeeeee"><table cellpadding="1" width="100%"  
cellspacing="0"><tr><td>Name:</td><td>Type:</td><td>Market:</td><td></ 
td></tr><tr><td><input size="30" name="s"></td><td><select  
name="t"><option selected value="S"> Stocks </option><option  
value="E"> ETFs </option><option value="I"> Indices </option><option  
value="M"> Mutual Funds </option><option value="F"> Futures </ 
option></select></td><td><select name="m"><option selected  
value="US">U.S. & Canada</option><option value="ALL">World Market</ 
option></select></td><td><input value="Look Up" type="submit"></td></ 
tr><tr><td valign="bottom" colspan="4"><small><a href="http:// 
finance.yahoo.com/exchanges">View supported exchanges</a></small></ 
td></tr></table></td></tr></table></form><table><tr><td  
align="left">2 results for <b>'Dupont'</b> (type=<b>Stocks</b>,  
market=<b>U.S. &amp; Canada</b>)</td></result>

Regards, Morton