Yeah this sort of thing can happen, some parsing gurus may have an idea of how to do it a bit better - I did think perhaps extracting the whole table and then replacing the HTML tags with commas and then splitting on the comma may be a slightly better solution. This works for now though...
Code:
Imports System.Text.RegularExpressions Sub Main(ByVal Parms As Object) Dim WebStr As String = hs.GetURL("http://www.melbournewater.com.au","/content/rivers_and_creeks/rainfall_and_river_level_data/site.asp?SiteID=16&bhcp=1", False, 80) Dim SplitStr() As String = Split(WebStr, "</td>") If UBound(SplitStr) > 0 Then hs.writelog("Flow", Regex.Replace(SplitStr(2), "<[^>]*>", "")) hs.writelog("FlowValue", Convert.ToDecimal(Regex.Replace(SplitStr(2), "[^0-9.]", ""))) hs.writelog("Level", Regex.Replace(SplitStr(5), "<[^>]*>", "")) hs.writelog("LevelValue", Convert.ToDecimal(Regex.Replace(SplitStr(5), "[^0-9.]", ""))) End If End Sub
Comment