Hello All,
I'm having trouble with a little string search. My code downloads a webpage that contains a table of a list of sharenames, the company name and a margin rate in the following format:
<tr class="odd">
<td>AAC</td>
<td>Australian Agricultural Company Limited.</td>
<td>35.00%</td>
<td>
No
</td>
<td>
No
</td>
<td>
Yes
</td>
</tr>
<tr class="even">
<td>AAD</td>
<td>ARDENT LEISURE GROUP</td>
<td>35.00%</td>
<td>
No
</td>
<td>
No
</td>
<td>
Yes
</td>
</tr>
<tr class="odd">
<td>AAE</td>
<td>Agri Energy Limited</td>
<td>100.00%</td>
<td>
No
</td>
<td>
No
</td>
<td>
No
</td>
</tr>
This is read in to a string from a streamreader:
string Result = sr.ReadToEnd();
I am looking to return the Margin rate eg <td>35%</td> for any given sharename (Name is a 3 letter id eg. AAC)
Code I have so far:
string regMatch = "<td>" + Name + "</td>";
if (Regex.IsMatch(Result, regMatch))
{
MessageBox.Show(Name + " Found");
}
else
MessageBox.Show(Name + " Not Found");
All this tells me is that the Sharename is found... How do I then return the Margin and perhaps even the company Name?