7 Replies - 3950 Views - Last Post: 01 June 2009 - 04:10 PM

#1 alexlafreniere   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 21-May 09

Regular Expression Help - Printing After A Match

Posted 30 May 2009 - 04:05 PM

I'm writing a script that retrieves stock quote information by downloading a web page from MSN Money. My problem is trying to use regular expressions to search through the source and print what's after a string I pre-defined. I want it to search for the source of the line that denotes the actual stock price and then print out the price of that stock. The problem is, I've only ever seen regular expressions used in conditionals, but that would be unnecessary in this case, I know that certain string is there, I just don't know what's after it. Here's what I have so far:

#!/usr/bin/perl
use LWP::Simple;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use HTML::LinkExtor;

print "enter a symbol to be searched:\n";
$input = <STDIN>;
$stockSymbol = chomp($input);
$url = "http://moneycentral.msn.com/detail/stock_quote?ipage=qd&Symbol=" . $stockSymbol;
$browser = LWP::UserAgent->new();
$browser->timeout(10);
my $request = HTTP::Request->new(GET => $url);
my $response = $browser->request($request);
if ($response->is_error()) {printf "%s\n", $response->status_line;}
$contents = $response->content();


$contents holds the entirety of the web page, and I want to search through that for this line:

<span class="s1" piprop="3" >STOCK PRICE GOES HERE</span>


And print out whatever is in that space. Any help with this would be greatly appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: Regular Expression Help - Printing After A Match

#2 KevinADC   User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 401
  • Joined: 23-January 07

Re: Regular Expression Help - Printing After A Match

Posted 30 May 2009 - 10:55 PM

my ($whatyouwant) = $content =~ /<span class="s1" piprop="3" >([^<]+)<\/span>/;
print $whatyouwant;


Was This Post Helpful? 0
  • +
  • -

#3 alexlafreniere   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 21-May 09

Re: Regular Expression Help - Printing After A Match

Posted 31 May 2009 - 09:14 AM

When I run this code nothing prints out... Does $whatyouwant get set equal to the stock price?
Was This Post Helpful? 0
  • +
  • -

#4 KevinADC   User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 401
  • Joined: 23-January 07

Re: Regular Expression Help - Printing After A Match

Posted 31 May 2009 - 01:50 PM

Try it with the "s" modifier on the end of the regexp and see if that helps.

my ($whatyouwant) = $content =~ /<span class="s1" piprop="3" >([^<]+)<\/span>/s;
print $whatyouwant;



$whatyouwant will be the value of what is between the start and end span tags you posted.

The better solution is to use an HTML parsing module but you will almost for sure have to install one and then learn its interface. Using a regexp is possible but is not a good long term solution as its whats often called "fragile" in that one small change in the html code and the regexp may no longer work.
Was This Post Helpful? 0
  • +
  • -

#5 alexlafreniere   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 21-May 09

Re: Regular Expression Help - Printing After A Match

Posted 31 May 2009 - 03:07 PM

I tried it with the "s" modifier and it didn't do a thing. I changed the script to print out $contents and it gives me the whole source of the page, when trying to print out $whatyouwant does nothing. I think it might just be that $whatyouwant isn't being set to anything.

This post has been edited by alexlafreniere: 31 May 2009 - 03:12 PM

Was This Post Helpful? 0
  • +
  • -

#6 KevinADC   User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 401
  • Joined: 23-January 07

Re: Regular Expression Help - Printing After A Match

Posted 31 May 2009 - 11:18 PM

Well, instead of making me guess, why not post the value of $content so I can see it and maybe understand what the problem is.
Was This Post Helpful? 0
  • +
  • -

#7 alexlafreniere   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 21-May 09

Re: Regular Expression Help - Printing After A Match

Posted 01 June 2009 - 12:32 PM

Okay so I entered GOOG as the stock I wanted information on. I had the script print out $contents and here's what it gave me:

<style type="text/css">
@import url("http://blstc.msn.com/br/gbl/css/9/gtl_sitegeneric.css");
@import url("http://blstc.msn.com/br/gbl/css/8/02.css");
@import url("http://blstc.msn.com/br/money/css/15/override.css");
@import url("/inc/css/nav.css?v=12");
@import url("/inc/css/12/2/theme.axd");
@import url("/inc/css/std.css?v=12");
#taxnav {color:#009900!important};
</style>
<!--[if IE]><style type="text/css">@import url("http://blstc.msn.com/br/gbl/css/9/ie.css");</style><![endif]-->
<!--[if IE 6]><style type="text/css">@import url("http://blstc.msn.com/br/gbl/css/2/ie6.css");</style><![endif]-->
<!--[if lt IE 5.5000]><style type="text/css">@import url("http://blstc.msn.com/br/gbl/css/8/ie5.css");</style><![endif]-->
<!--[if !IE]>--><script type="text/javascript" src="http://blstj.msn.com/br/gbl/js/4/mozcompat.js"></script><!--<![endif]-->
<script type="text/javascript" src="http://blstj.msn.com/br/gbl/js/4/core.js"></script>
<script type="text/javascript" src="http://blstj.msn.com/br/gbl/js/2/report.js"></script>
<script type="text/javascript" src="http://blstj.msn.com/br/gbl/js/7/navigation.js"></script>
<!--[if IE]><style type="text/css">@import "/inc/css/ie-all.css?v=12";</style><![endif]-->
<!--[if !IE]>--><style type="text/css">@import "/inc/css/ie-none.css?v=12";</style><!--<![endif]-->


</head>
<body>
<div id="wrapper" class="page9 region9"><img width="1" height="1" src="http://c.msn.com/c.gif?TP=HTTP://MONEYCENTRAL.MSN.COM/INVESTOR/COMMON/FINDSYMBOL.ASP&PS=45887&PI=7288&DI=7290&RF=" style="position:absolute;left:0px;top:0px;z-index:-1" /><div id="head"><div class="parent chrome6 single1"><div class="child c1 first"><div class="msnhead1 cf"><ul id="big3" class="linklist9"><li class="first"><a href="http://g.msn.com/0nwenus0/AD/00" target="_top">MSN home</a></li><li><a href="http://g.msn.com/0nwenus0/AD/02" target="_top">Mail</a></li><li><a href="http://g.msn.com/0nwenus0/AD/01" target="_top">My MSN</a></li><li class="last"><a href="http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1243884532&rver=5.5.4177.0&wp=MBI&wreply=http:%2F%2Fmoneycentral.msn.com%2Fpploggedin.aspx%3FPage%3Dhttp%253A%252F%252Fmoneycentral%252Emsn%252Ecom%252Finvestor%252Fcommon%252Ffindsymbol%252Easp%26Query%3DCompany%253D1%2526nextpage%253Dhttp%25253a%25252f%25252fmoneycentral%252Emsn%252Ecom%25252fdetail%25252fstock%255Fquote&lc=1033&id=229">Sign in</a></li></ul><ul id="xnav"><li class="first"><a href="http://autos.msn.com/" target="_top">autos</a></li><li class="selected"><a href="http://moneycentral.msn.com/home.asp" target="_top">money</a></li><li><a href="http://msn.foxsports.com/" target="_top">sports</a></li><li><a href="http://tech.msn.com/" target="_top">tech</a></li></ul><div id="more" class="col5 cf"><ul class="linkedimglinklist1 cf"><li class="first"><a target="_top" href="http://mail.live.com"><img src="http://tk2.stb.s-msn.com/i/96/5146F629B72E6A89B01B5FF61E30B8.gif" width="25" height="20" alt="Hotmail" /><span>Hotmail</span></a></li><li><a target="_top" href="http://download.live.com/?sku=messenger"><img src="http://tk2.stb.s-msn.com/i/96/5146F629B72E6A89B01B5FF61E30B8.gif" width="25" height="20" alt="Messenger" /><span>Messenger</span></a></li><li><a target="_top" href="http://my.msn.com"><img src="http://tk2.stb.s-msn.com/i/96/5146F629B72E6A89B01B5FF61E30B8.gif" width="25" height="20" alt="My MSN" /><span>My MSN</span></a></li><li class="last"><a target="_top" href="http://ie8.msn.com/microsoft/internet-explorer-8/en-us/ie8.aspx?ocid=B037MSN55C0403A"><img src="http://tk2.stb.s-msn.com/i/96/5146F629B72E6A89B01B5FF61E30B8.gif" width="25" height="20" alt="Internet Explorer 8" /><span>Internet Explorer 8</span></a></li></ul><ul class="linklist1"><li class="first"><a target="_top" href="http://travel.msn.com/default.aspx">Airfares & Travel</a></li><li><a target="_top" href="http://autos.msn.com/default.aspx">Autos</a></li><li><a target="_top" href="http://careers.msn.com">Careers & Jobs</a></li><li><a target="_top" href="http://cityguides.msn.com">City Guides</a></li><li class="last"><a target="_top" href="http://msn.match.com/index.aspx?TrackingID=516163&BannerID=543351 ">Dating & Personals</a></li></ul><ul class="linklist1"><li class="first"><a target="_top" href="http://msn.delish.com/">Food & Entertaining</a></li><li><a target="_top" href="http://games.msn.com">Games</a></li><li><a target="_top" href="http://health.msn.com">Health & Fitness</a></li><li><a target="_top" href="http://astrocenter.astrology.msn.com/msn/DeptHoroscope.aspx?When=0&Af=-1000&VS">Horoscopes</a></li><li class="last"><a target="_top" href="http://lifestyle.msn.com/default.aspx">Lifestyle</a></li></ul><ul class="linklist1"><li class="first"><a target="_top" href="http://maps.live.com/default.aspx?wip=2&v=2&rtp=~&FORM=MSNH">Maps & Directions</a></li><li><a target="_top" href="http://moneycentral.msn.com/home.asp">Money</a></li><li><a target="_top" href="http://movies.msn.com/">Movies</a></li><li><a target="_top" href="http://music.msn.com">Music</a></li><li class="last"><a target="_top" href="http://www.msnbc.msn.com/">News</a></li></ul><ul class="linklist1"><li class="first"><a target="_top" href="http://realestate.msn.com">Real Estate/Rentals</a></li><li><a target="_top" href="http://g.msn.com/0AD00036/931292.1??HCType=1&CID=931292&PG=SHPHDR">Shopping</a></li><li><a target="_top" href="http://msn.foxsports.com/">Sports</a></li><li><a target="_top" href="http://tech.msn.com">Tech & Gadgets</a></li><li class="last"><a target="_top" href="http://tv.msn.com">TV</a></li></ul><ul class="linklist1"><li class="first"><a target="_top" href="http://weather.msn.com">Weather</a></li><li><a target="_top" href="http://msn.whitepages.com/">White Pages</a></li><li><a target="_top" href="http://www.wonderwall.com/">Wonderwall</a></li><li><a target="_top" href="http://yellowpages.msn.com">Yellow Pages</a></li><li class="last"><a target="_top" href="http://specials.msn.com/alphabet.aspx">MSN Directory</a></li></ul><script type="text/javascript">Msn.Header.bind("#head",{more:"more"});</script></div><div id="brand"><div id="logo"><a href="http://g.msn.com/0nwenus0/AD/14" target="_top"><noscript><img width="118" height="35" src="http://blstc.msn.com/br/gbl/lg/1/m/msft.gif" /></noscript><script type="text/javascript" src="/inc/chan/msnlogo.asp"></script></a><a href="http://moneycentral.msn.com/home.asp" class="name" target="_top">money</a></div><form id="search" onsubmit="return Msn.Report.TrackForm(this)" action="http://search.live.com/results.aspx" method="get" target="_top"><input name="FORM" value="AD" type="hidden" /><input name="cp" value="1252" type="hidden" /><div><label accessKey="s" for="q">Live search:</label><div id="ntwscopes"></div><div id="leftcorner"></div><div id="searchform"><div class="searchinputarea"><div class="searchinput"><input id="q" class="typing" title="Search for" maxLength="215" name="q" type="text" /></div><div class="searchsubmit"><input id="spyglass" alt="Site" src="http://blstc.msn.com/br/gbl/css/9/decoration/searchicon_22x22.gif" type="image" /></div></div></div><div id="ntwlogo"><input id="logoimg" alt="bing.com" src="http://blstc.msn.com/br/gbl/css/9/decoration/logo_56x29.png" type="image" /></div><div id="rightcorner"></div></div></form><script type="text/javascript">Msn.SiteSearch.bind("#search",{searchParam:"q",searchParams:"fmt=1",searchUrl:"http://moneycentral.msn.com/money.search",sitetext:"Money",webtext:"Web",siteSearchOn:"true",helpertext:"",onepxgif:"http://blstc.msn.com/br/gbl/css/9/decoration/t.gif"});</script><div id="optlinks" class="link"><a href="#" onclick="java script:top.DoHelp();return false;">Help</a></div></div></div></div></div></div><script type="text/javascript">phid="MC_300";</script>
<div id="page"><div id="nav"><div class="parent chrome6 single1"><div class="child c1 first"><div class="nav3 cf">
<ul>
<li class="first"><a href="http://moneycentral.msn.com/home.asp" target="_top">Home</a></li>
<li class="pretab"><a href="http://news.moneycentral.msn.com/newscenter/newscenter.aspx" target="_top">News</a></li>
<li class="selected"><a href="http://moneycentral.msn.com/investor/home.aspx" target="_top">Investing</a></li>
<li><a href="http://moneycentral.msn.com/personal-finance/" target="_top">Personal Finance</a></li>
<li><a href="http://articles.moneycentral.msn.com/taxes/home.aspx" target="_top">Tax</a></li>
<li><a href="http://moneycentral.msn.com/community/default.asp" target="_top">Community</a></li>
<li><a href="http://moneycentral.msn.com/banking/moneyplushome.asp" target="_top">My Money</a></li>
<li class="last"><a href="http://businessonmain.msn.com?source=msnmoneypromo" target="_top">Small Business</a></li>
<li id="whatsnew"><a href="http://articles.moneycentral.msn.com/whatsnew.aspx" target="_top"><span>NEW</span> on MSN Money</a></li>
</ul>


<ul id="N3">
<li class="first"><a href="/investor/home.aspx" target="_top">Investing Home</a></li>
<li><a href="http://moneycentral.msn.com/stock_portfolio" target="_top">Portfolio</a></li>
<li><a href="http://moneycentral.msn.com/investor/market/home.aspx" target="_top">Markets</a></li>
<li class="selected"><a href="http://moneycentral.msn.com/investor/research/welcome.asp" target="_top">Stocks</a></li>
<li><a href="http://moneycentral.msn.com/investor/research/fundwelcome.asp?Funds=1" target="_top">Funds</a></li>
<li><a href="http://moneycentral.msn.com/investor/research/etfs.aspx" target="_top">ETFs</a></li>
<li><a href="http://articles.moneycentral.msn.com/Commentary/ByDate/InvestingThisWeek.aspx" target="_top">Commentary</a></li>
<li class="last"><a href="http://moneycentral.msn.com/investor/trading/brokers.asp" target="_top">Brokers</a></li>
</ul>
<div id="qbe"><table id="downwrap"><tr><td id="qbesum"><form action="http://moneycentral.msn.com/detail/stock_quote" method="get" target="_top"><label for="txtQbe" accesskey="q">Name or symbol(s)</label><input type="text" maxlength="1024" size="18" id="txtQbe" name="Symbol" autocomplete="off" value="Name or symbol(s)" onfocus="if(this.value=='Name or symbol(s)')this.value=''" onblur="if(this.value=='')this.value='Name or symbol(s)'" /> <input type="submit" id="getquote" name="getquote" value="Get Quote" /></form><div class="first"><a href="http://moneycentral.msn.com/index_quote/%24INDU" target="_top">Dow</a> <span class="s4" >+232.34</span><img src="/inc/images/smup.gif" alt="up" /><span class="s4" >+2.73%</span><br />8,732.67</div><div><a href="http://moneycentral.msn.com/index_quote/%24COMPX" target="_top">Nasdaq</a> <span class="s4" >+50.90</span><img src="/inc/images/smup.gif" alt="up" /><span class="s4" >+2.87%</span><br />1,825.23</div><div class="last"><a href="http://moneycentral.msn.com/index_quote/%24INX" target="_top">S&P</a> <span class="s4" >+24.28</span><img src="/inc/images/smup.gif" alt="up" /><span class="s4" >+2.64%</span><br />943.42</div></td><td id="qbeadvert"><div><script type="text/javascript">if(typeof(dap)!="undefined"){dap("&PG=INVXT1&AP=1440",120,10);}</script><br /><b><a href=http://moneycentral.msn.com/investor/market/home.aspx target="_top">U.S. markets open</a></b></div></td></tr></table></div><script type="text/javascript" src="/inc/scr/ww.js?v=12"></script></div></div></div></div>
<div id="content"><div id="area1" class="region2"><div class="parent chrome6 double2"><div class="nav1"><ul>
<li class="first"><strong>Quote, Chart, News</strong></li>
<li><a href="http://moneycentral.msn.com/investor/research/newsnap.asp" target="_top">Snapshot</a></li>
<li><a href="http://moneycentral.msn.com/companyreport" target="_top">Company Report</a></li>
<li><a href="http://moneycentral.msn.com/detail/stock_quote" target="_top">Quotes</a>
</li> <li><a href="http://moneycentral.msn.com/investor/charts/charting.asp" target="_top">Charts</a>
</li> <li><a href="http://moneycentral.msn.com/news/ticker/sigdev.aspx" target="_top">Key Developments</a></li>
<li><a href="http://news.moneycentral.msn.com/ticker/rcnews.aspx" target="_top">Recent News</a></li>
<li><strong>Research</strong></li>
<li><a href="http://moneycentral.msn.com/investor/sec/filing.asp" target="_top">SEC Filings</a></li>
<li><a href="http://moneycentral.msn.com/investor/invsub/advisor/advisor.asp" target="_top">Advisor FYI</a></li>
<li><a href="http://msncaps.fool.com/TickerRankings.aspx?filter=2&sortcol=38" target="_top">CAPS</a></li>
<li><a href="http://moneycentral.msn.com/investor/StockRating/srsmain.asp" target="_top">StockScouter</a>
</li> <li><a href="http://moneycentral.msn.com/investor/invsub/analyst/earnest.asp" target="_top">Earnings Estimates</a></li>
<li><a href="http://moneycentral.msn.com/investor/invsub/analyst/recomnd.asp" target="_top">Analyst Ratings</a></li>
<li><a href="http://moneycentral.msn.com/investor/invsub/results/hilite.asp" target="_top">Financial Results</a>
</li> <li><a href="http://moneycentral.msn.com/investor/invsub/insider/trans.asp" target="_top">Insider Trading</a></li>
<li><a href="http://moneycentral.msn.com/ownership" target="_top">Ownership</a></li>
<li><a href="http://moneycentral.msn.com/community/commredir.asp" target="_top">Message Board</a></li>
</li> <li><strong>Guided Research</strong></li>
<li><a href="http://moneycentral.msn.com/investor/research/wizards/SRW.asp" target="_top">Research Wizard</a>
</li> <li><strong><div style="margin-top:10px;font-weight:700;">Find Stocks</div></strong></li>
<li><a href="http://moneycentral.msn.com/investor/finder/customstocks.asp" target="_top">Stock Screener</a>
</li> <li><a href="http://moneycentral.msn.com/investor/finder/predefstocks.aspx" target="_top">Stock Power Searches</a></li>
<li><a href="/investor/StockRating/srstopstocksresults.aspx?sco=10" target="_top">Top-Rated Stocks</a></li>
<li><strong>Related Links</strong></li>
<li><a href="http://moneycentral.msn.com/investor/quotewatchlist.asp" target="_top">Quote Watchlist</a></li>
<li><a href="/investor/MSNStockPicks/toppickers.asp" target="_top">Expert Picks</a></li>
<li><a href="http://moneycentral.msn.com/Comcenter/" target="_top">E-mail & Alerts</a></li>
<li><a href="http://moneycentral.msn.com/investor/market/ipomain.asp" target="_top">IPO Center</a></li>
<li><a href="http://moneycentral.msn.com/community/message/board.asp" target="_top">Message Boards</a></li>
<li><a href="http://moneycentral.msn.com/tax/gkentry.aspx" target="_top">Capital Gains Analysis</a></li>
</ul>
</div></div></div>

<div id="area2" class="region8 legacy"><h1>Find Symbol</h1><table id="pg"><tr><td class="pg">
<p>Your search returned too many matches. Only the first 100 are displayed. Please enter more specific search terms.   <a href="find.asp?NextPage=http://moneycentral.msn.com/detail/stock_quote">New Search</a></p><table class="t1"><colgroup span="2" class="c1" />
<tr class="rs2"><th colspan="2">Search Results</th></tr><tr class="r0"><th>Symbol</th><th>Company Name</th></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ATTY">ATTY</a></td><td>1-800-ATTORNEY Inc</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FLWS">FLWS</a></td><td>1-800-Flowers.com Inc</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=OFRCF">OFRCF</a></td><td>104 Corporation</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ELLQ">ELLQ</a></td><td>1150 Liquidating Corp</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=OAVTF">OAVTF</a></td><td>123 Advanced Telecommunications Ltd</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ONCP">ONCP</a></td><td>141 Capital Inc</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=OTROQ">OTROQ</a></td><td>1608557 Ontario Inc</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FAMB">FAMB</a></td><td>1st American Bancorp Inc</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FISB">FISB</a></td><td>1st Capital Bank</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FCEN">FCEN</a></td><td>1st Centennial Bancorp</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FCTY">FCTY</a></td><td>1st Century Bancshares Inc</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FCOB">FCOB</a></td><td>1st Colonial Bancorp Inc</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FCCY">FCCY</a></td><td>1st Constitution Bancorp</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FENB">FENB</a></td><td>1st Enterprise Bank</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FFIS">FFIS</a></td><td>1st Financial Services Corp</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FGBF">FGBF</a></td><td>1st Global Financial Corp</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FHBY">FHBY</a></td><td>1st Home Buy & Sell Ltd</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FNRC">FNRC</a></td><td>1st NRG Corp</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FPBN">FPBN</a></td><td>1st Pacific Bancorp</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=SRCE">SRCE</a></td><td>1st Source Corp</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FSMK">FSMK</a></td><td>1ST SUMMIT BANCORP of Johnstown Inc</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FTXN">FTXN</a></td><td>1st Texas Natural Gas Co Inc</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=FSDB">FSDB</a></td><td>1st United Bancorp Inc (Florida)</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ADDPI">ADDPI</a></td><td>A&D Pharma 144A Depository Receipt</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AOTY">AOTY</a></td><td>A-1 Technology Inc</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=XXAAF">XXAAF</a></td><td>Aaa Net Realty Fund 10 LP</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=XXAAY">XXAAY</a></td><td>Aaa Net Realty Fund 10 Units</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ABYPF">ABYPF</a></td><td>Abbey National 10.375% Non Cumulative Pref Shs</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ACCCY">ACCCY</a></td><td>Accton Depository Receipt 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ADPAS">ADPAS</a></td><td>Adelphia Recovery Ser ACC 1 Interest Units</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ADDYY">ADDYY</a></td><td>Adidas-Salomon ADR 0.5 Rep 1 ord shs</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ADDDY">ADDDY</a></td><td>Adidas-Salomon ADR rep 1 Ord Shs 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ADYBY">ADYBY</a></td><td>Aditya Birla Nuvo GDR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AECNY">AECNY</a></td><td>AECI ADR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=XXAGB">XXAGB</a></td><td>AEI Real Estate Fund 16 Units</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=XXAGC">XXAGC</a></td><td>AEI Real Estate Fund 17 Units</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AERAY">AERAY</a></td><td>Aeroflot 144A GDR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AFIDL">AFIDL</a></td><td>AFI Development GDR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=JSFCY">JSFCY</a></td><td>AFK Sistema 144A GDR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ARBJY">ARBJY</a></td><td>African Rainbow Minerals Sponsored 144A ADR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AGORY">AGORY</a></td><td>Agora Sponsored GDR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AIRLK">AIRLK</a></td><td>Airlie CDO I PS1 144A Pref Shs</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AIRLJ">AIRLJ</a></td><td>Airlie CDO I PS2 144A Pref Shs</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AKBDY">AKBDY</a></td><td>Akbank Turk 144A ADR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ARTAU">ARTAU</a></td><td>Aleritas Capital Units Exp 13 July 2009</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ATAZY">ATAZY</a></td><td>Alitalia Linee Aeree Italiane SPA Sponsored 144A ADR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AALQY">AALQY</a></td><td>All America Latina Logistica GDR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AALQL">AALQL</a></td><td>All America Latina Logistica Rep 10 Pref 144A GDR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ALCEL">ALCEL</a></td><td>Alliance Bank JSC Sponsored GDR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=DRRFF">DRRFF</a></td><td>Allianz Dres End Pol Tst 10 PLC</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ALAXL">ALAXL</a></td><td>Almacenes Exito GDR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ALAXY">ALAXY</a></td><td>Almacenes Exito GDR 144A 12/2007</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ALBQY">ALBQY</a></td><td>Alpha Bank 144A GDR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AMB%2DL">AMB-L</a></td><td>AMB Property 6 1/2% Cumulative Redemable Pref Shs Series L</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AMBUY">AMBUY</a></td><td>Ambuja Cements Sponsored GDR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AO%2DA">AO-A</a></td><td>Amerco 8 1/2% Pref Shs Series A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AMGZP">AMGZP</a></td><td>AMG Capital I Pref Shs 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AEBMY">AEBMY</a></td><td>Anadolu Efes Biracilik Ve Malt Sanayi SA Sponsored 144A GDR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=XXBVD">XXBVD</a></td><td>Angeles Partners 10 Units</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=XXBVE">XXBVE</a></td><td>Angeles Partners 11 Units</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=XXBVF">XXBVF</a></td><td>Angeles Partners 12</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AHOUL">AHOUL</a></td><td>Anthousa 144A GDR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=XXAJG">XXAJG</a></td><td>Apache Grove Land Program 1972 LP</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=APOQF">APOQF</a></td><td>Apollo Hospitals 144A DR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ABPTY">ABPTY</a></td><td>Arab Potash Depository Receipt 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ASWZY">ASWZY</a></td><td>Arisawa Depository Receipt 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ARZMY">ARZMY</a></td><td>Arvind 144A GDR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AEC%2DB">AEC-B</a></td><td>Associated Estates Realty Depositary Shares Repstg 1/10 8.70</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AKCIY">AKCIY</a></td><td>Asustek Computer 144A GDR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AKCIF">AKCIF</a></td><td>Asustek Computer ADR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ANTEH">ANTEH</a></td><td>Atlantic City Electric 4.35% Pref Shs Series 1</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=ATCTU">ATCTU</a></td><td>ATS Units 19-Oct-2009</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AUCDL">AUCDL</a></td><td>Auction Pass Through 144A Pref Shs Class B</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AUCQK">AUCQK</a></td><td>Auction Pass Through Pref Shs Class A 2007-T5 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AUCQM">AUCQM</a></td><td>Auction Pass Through Pref Shs Class B 2007-T5 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AUCQL">AUCQL</a></td><td>Auction Pass Through Trust 144A 2006-5</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AUCQZ">AUCQZ</a></td><td>Auction Pass Through Trust 144A 2006-5</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AUCZZ">AUCZZ</a></td><td>Auction Pass Through Trust 144A 2006-6</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AUCZL">AUCZL</a></td><td>Auction Pass Through Trust 144A 2006-6</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AUNPY">AUNPY</a></td><td>Auction Pass Through Trust 144A 2007-1</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AUNPL">AUNPL</a></td><td>Auction Pass Through Trust 144A 2007-1</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AIONK">AIONK</a></td><td>Auction Rate SecuritiesTrust 2007-1</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AIONM">AIONM</a></td><td>Auction Rate SecuritiesTrust 2007-1</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AVSEY">AVSEY</a></td><td>Avis Europe Sponsored ADR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AWBZY">AWBZY</a></td><td>AWB ADR Reptg 10 Ord Shs Class B</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AXBKY">AXBKY</a></td><td>Axis Bank Sponsored GDR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AXBAY">AXBAY</a></td><td>Axis Bank Temporary GDR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=AXTLY">AXTLY</a></td><td>Axtel Sponsored 144A ADR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=BJJHY">BJJHY</a></td><td>Bajaj Hindustan Depository Receipt 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=BLPRY">BLPRY</a></td><td>Ballarpur Industries 144A GDR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=BLPQY">BLPQY</a></td><td>Ballarpur Industries 144A GDR rep 5 ord shs</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=BGLEN">BGLEN</a></td><td>Baltimore Gas & Electric Company 6.70% Pref Shs Series 1993</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=BGLEH">BGLEH</a></td><td>Baltimore Gas & Electric Company 6.97% Pref Shs Series 1993</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=BGLEI">BGLEI</a></td><td>Baltimore Gas and Electric 7.125% Pref Shs Series 1993</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=BBV">BBV</a></td><td>Banco Bilbao Vizcaya Argentaria Each Repr 1 Ord ADR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=BOROY">BOROY</a></td><td>Banco De Oro Unibank GDR 144A</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=STD">STD</a></td><td>Banco Santander ADR Rep 1 Ord Shs</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=BFFO">BFFO</a></td><td>Bank 1440</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=BQACY">BQACY</a></td><td>Bank Audi Sal 144A GDR</td></tr>
<tr><td><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=BAAHY">BAAHY</a></td><td>Bank Austria Participation Certificates 144A</td></tr>
</table>

</td><td class="pg"><div class="ad4"><h6>advertisement</h6><!--PG=INVIHP--><script type="text/javascript">dap('&PG=INVIHP&AP=1089',300,250);</script></div>

</td></tr>
</table>


<div class="m">
<h2>Your latest quotes</h2>
<p>Up to six of your latest stock or fund quotes will appear here.</p>
<p class="a1"><a href="http://moneycentral.msn.com/detail/stock_quote?Symbol=">Get quotes</a></p>
</div>

<div class="parent single1"><div class="child c1 first"><ul class="singlelist2"><li><a href="/inc/attributions.asp" target="_top"><b>Data providers</b></a></li><li><span style="white-space:nowrap">Copyright © 2009 <a href="http://www.reuters.com" target="_top">Thomson Reuters</a>. <a href="http://about.reuters.com/media/customer_support/branding/popups/full_legal_notice.htm" target="_blank">Click for Restrictions.</a></span></li><li>Quotes supplied by <a href="http://www.interactivedata-rts.com/" target="_top">Interactive Data</a>.</li></ul></div></div></div></div></div>
<div id="foot"><div class="parent chrome6 single1"><div class="child c1 first"><div class="msnfoot1 cf">
<ul class="primary">
<li class="first"><a href="http://g.msn.com/0PR_/enus" target="_top">MSN privacy</a></li>
<li><a href="http://g.msn.com/0TO_/enus" target="_top">Legal</a></li>
<li><a href="http://g.msn.com/0nwenus0/AD/19" target="_top">Advertise</a></li>
<li class="last"><a href="http://moneycentral.msn.com/community/rss/MoneyFeeds.aspx" target="_top">RSS</a></li>
</ul>
<ul class="secondary">
<li class="first"><a href="#" onclick="java script:top.DoHelp();return false;">Help</a></li>
<li><a href="#" onclick="java script:top.O_LC();return false;">Feedback</a></li>
<li class="last"><a href="http://moneycentral.msn.com/help/sitemap.asp" target="_top">Site map</a></li>
</ul>
<div class="copyright"><span>© <script type="text/javascript">document.write(Math.max(2009,(new Date()).getYear()));document.close();</script><noscript>2009</noscript> Microsoft</span></div>
</div></div></div></div>
<!--[if lt IE 7]><script type="text/javascript">document.write("<script type=\"text/javascript\" src=\"" + ((document.location.protocol == "https:") ? "https://secure.footprint.net/bstmsn" : "http://blstj.msn.com") + "/br/gbl/js/3/ieminwidth.js\"><" + "/script>");document.close();</script><![endif]-->
</div><img height="1" width="1" src="http://switch.atdmt.com/action/MSN_enUS_Money"/><script type="text/javascript">var s_account="msnportalmoney";</script><div style="display:none"><script type="text/javascript" src="http://blstj.msn.com/br/om/js/s_code.js"></script><script type="text/javascript" src="/inc/chan/omni.ashx?p=%2finvestor%2fcommon%2ffindsymbol.asp&v=633764104270000000"></script><noscript><img src="http://msnportalmoney.112.2O7.net/b/ss/msnportalmoney/1/H.1--NS/0" height="1" width="1" border="0" alt="" /></noscript></div><script type="text/javascript">if(typeof(top.LogErr)!="undefined")window.onerror=top.LogErr;</script><!--A04:65.54.150.54:6/1/2009 12:28:52 PM-->

</body>
</html>



And here's the line with the stock price on it:

<tr class="rs0"><th colspan="4"><span class="s1" piprop="3" >426.06</span> <img src="/inc/images/up.gif" alt="up"/> <span class="s4" piprop="13" >+8.83 </span> <span class="s4" piprop="14" >+2.12%</span></th></tr><tr><td id="MarketMessage" colspan="4"><span class="s5">NEW</span><span class="s1"> Real Time:</span> <span class="s1" piprop="797" >426.73</span><span class="s4" piprop="806">+9.50</span><span class="s4" >/</span>

Was This Post Helpful? 0
  • +
  • -

#8 KevinADC   User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 401
  • Joined: 23-January 07

Re: Regular Expression Help - Printing After A Match

Posted 01 June 2009 - 04:10 PM

The line with the stock price is not in the html source code you posted ($content).

Probably that data is generated dynamically by javascript, in which case I am not sure how you can get it into your perl script.

This post has been edited by KevinADC: 01 June 2009 - 04:16 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1