Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML PARSING Help (Reg Exp) 1

Status
Not open for further replies.

eatr

Technical User
Jan 20, 2006
48
Need to work through the source of an HTML page and pull out
certain pieces of data:

A number of questions:

1) how do I completely remove a strip of text, for example the following?:

<html>
<head>
<title>
Instant Charts (FREE)</title>
<link rel=alternate media=print href="<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
<!--
var newhome = null;
function handleTrkChange(name)
{
if(document.race_track_form!=null)
{
if(document.race_track_form.name.selectedIndex!=0)
{ document.race_track_form.whichchanged.value = "track"; document.race_track_form.submit();}
}
}
function handleRaceChange(name)
{
if(document.race_track_form!=null)
{
if(document.race_track_form.name.selectedIndex!=0)
{ document.race_track_form.whichchanged.value = "race"; document.race_track_form.submit();}
}
}
function popup_newhome(url)
{
newhome = window.open(url, "newhome", "menubar=1, toolbar=1, location=1, status=1, scrollbars=1, resizable=1, top=20, left=30, width=600, height=400");
newhome.focus();
}
-->
</script>
</head>
<body bgcolor="#FFFFFF">
<style type="text/css">
tr, td, th, p, body { font-size: 10pt; font-family: inherit; }
td.bigger{font-size: 12pt; font-family: inherit;}
a.bigger{font-size: 12pt; font-family: inherit;}
</style>
<!-- web3.bloodstock -->
<center>
<table border=0 cellpadding=0 cellspacing=0 width=600>
<tr><td>
<a
href="src="/icons/buttons/products.gif" border=0 width=154 height=20 alt="Products &amp; Reports"></a><img
src="/icons/spacer.gif" width=3 height=1 alt=" " border=0><a
href="src="/icons/buttons/supertote.gif" border=0 width=100 height=20 alt="SuperTote"></a><img
src="/icons/spacer.gif" width=3 alt=""><a
href="src="/icons/buttons/software.gif" border=0 width=129 height=20 alt="FREE Software"></a><img
src="/icons/spacer.gif" width=3 alt=""><a
href="src="/icons/buttons/bookstore.gif" border=0 width=118 height=20 alt="Bookstore"></a><img
src="/icons/spacer.gif" width=3 alt=""><a
href="src="/icons/buttons/stable.gif" border=0 width=84 height=20 alt="Stable Alert"></a>
</td></tr>
<tr><td>
<img src="/icons/headers/inc.gif" width=600 height=65 alt="Instant Charts (FREE)">
</td></tr>
<tr><td>
<a
href="src="/icons/buttons/edge.gif" border=0 width=154 height=20 alt="Handicapper's Edge"></a><img
src="/icons/spacer.gif" width=3 alt=""><a
href="src="/icons/buttons/tsnnews.gif" border=0 width=100 height=20 alt="TSN News"></a><img
src="/icons/spacer.gif" width=3 alt=""><a
href="src="/icons/buttons/signup.gif" border=0 width=129 height=20 alt="FREE Sign-up"></a><img
src="/icons/spacer.gif" width=3 alt=""><a
href="src="/icons/buttons/tsnbet.gif" border=0 width=118 height=20 alt="TSNBet"></a><img
src="/icons/spacer.gif" width=3 alt=""><a
href="src="/icons/buttons/home.gif" border=0 width=84 height=20 alt="Home"></a>
</td></tr>
<tr><td>
<img src="/icons/spacer.gif" width=600 height=4 alt="">
</td></tr>
<tr><td>

<!-- Banner from _adout("inc") -->
<CENTER>
<A HREF=" TARGET="_top"><IMG SRC=" ALT="Save All Month Long on Condensed & Condensed Ultimate PPs" WIDTH=468 HEIGHT=49 BORDER=0></A>
</CENTER>

2) given the following piece of text:

<p>
<hr>
<font style="font-size: 12pt"><b><a href=" name="#R1">1st Race</a> - Aqueduct - Thursday, March 9th, 2006</b></font>
<p align=justify>
<b>Conditions:</b> 6F Dirt. INNER DIRT FOR FOUR YEAR OLDS AND UPWARD. Weight, 123 lbs. Non-winners Of Two Races Since January 9 Allowed 3 lbs. A Race Since Then Allowed 5 lbs. Claiming Price $14,000 (Races where entered for $12,500 or less not considered).<br>
<b>Purse:</b> $21,000 <b>Value of Race:</b> $21,000 <b>1st</b> $12,600 <b>2nd</b> $4,200 <b>3rd</b> $2,100 <b>4th</b> $1,050 <b>5th</b> $630 <b>6th</b> $210 <b>7th</b> $210


how do I pull out into a variable/variables the portion from '1st Race', all the way to 'considered)'.


3) given the text:

<table cellspacing=0 cellpadding=1><tr valign=top><td nowrap><b>Off Time:</b> 1:02 &nbsp;&nbsp;&nbsp;<b>Start:</b> 7 went. Good for all. Ridden out.&nbsp;&nbsp;&nbsp;<b>Track:</b> Fast&nbsp;&nbsp;&nbsp;<b>Weather:</b> Cloudy 48<sup>o</sup></td></tr></table>
<table cellspacing=0 cellpadding=1><tr valign=top><td><b>Fractions:</b> :22<sup>4</sup>, :45<sup>3</sup>, :57<sup>4</sup>, 1:11&nbsp;&nbsp;&nbsp; :)22.89, :45.78, :57.96, 1:11.07)</td></tr></table>


how do I get the numbers within the parens :)22.89, etc.) into an array


no looking for someone to write the code completely
an example or 2 would point me in the right direction

thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top