This can be done using groups. This allows you to name a part of the regular expression, as you would a variable, and then retrieve only this part by name. It is a very powerful feature of regular expressions. This may be a bit of a jump from what you were doing. So if you have an problems Id be happy to help.
Your text.
Code:
<TR ALIGN=CENTER VALIGN=CENTER><TD><FONT COLOR=#FFCC33> 11:40</FONT></TD> <TD><FONT COLOR=#FFCC33>1.54</FONT></TD>
This expression will match the whole of the text. Ive labeled the bits you are interested in itemone and itemtwo
Code:
\<TR ALIGN=CENTER VALIGN=CENTER\>\<TD\>\<FONT COLOR=[a-zA-Z0-9#]{1,}\>(?<itemone>[0-9:]{1,})\<\/FONT\>\<\/TD\> \<TD\>\<FONT COLOR=[a-zA-Z0-9#]{1,}\>(?<itemtwo>[0-9.]{1,})\<\/FONT\>\<\/TD\>
To get the part of the regular expression you are interested in you can use some code like this. Not great but gives you the idea.
Code:
Public Function ReturnValues(ByVal RegularExpression As String, ByVal mytext As String, ByVal item As String) As String()
Dim myRegExp As New Regex(RegularExpression, RegexOptions.IgnoreCase)
Dim Matchs As MatchCollection = myRegExp.Matches(mytext)
Dim currentMatch As Match
Dim matchedValues As New ArrayList
For Each currentMatch In Matchs
Dim myCaptures As CaptureCollection = currentMatch.Groups(item).Captures
Dim currentItem As Capture
For Each currentItem In myCaptures
matchedValues.Add(currentItem.Value)
Next
Next
Return CType(matchedValues.ToArray(GetType(String)), String())
End Function
and call it by
Code:
Dim myPattern As String = "\<TR ALIGN=CENTER VALIGN=CENTER\>\<TD\>\<FONT COLOR=[a-zA-Z0-9#]{1,}\>(?<itemone>[0-9:]{1,})\<\/FONT\>\<\/TD\> \<TD\>\<FONT COLOR=[a-zA-Z0-9#]{1,}\>(?<itemtwo>[0-9.]{1,})\<\/FONT\>\<\/TD\>"
Dim myText As String = "<TR ALIGN=CENTER VALIGN=CENTER><TD><FONT COLOR=#FFCC33>11:40</FONT></TD> <TD><FONT COLOR=#FFCC33>1.54</FONT></TD>"
Dim oneValues() As String = ReturnValues(myPattern, myText, "itemone")
Dim twoValues() As String = ReturnValues(myPattern, myText, "itemtwo")
In this example the oneValues array will contain only "11:40" and the twoValues "1.54" but if there were more lines matching the pattern, i.e. a table, then youd get a list of all the matching numbers in that column.
This is what I spend my time doing, using regular expressions to read tables of data and do calculations on it