Imports System
Imports System.Text.RegularExpressions

Public Class Test
	Public Shared Sub Main()
		Dim HTMLString As String = "<HTML>" & Environment.NewLine & _
                "    <body bgcolor=""#FF0000"">" & Environment.NewLine & _
                "        <span style=""color: #FFA966"" id=""firstspan"">Hello, I am a TeXT. Who are you?</span>" & Environment.NewLine & _
                "    </body>" & Environment.NewLine & _
                "</HTML>"
                
                Console.WriteLine("--- Input ---" & Environment.NewLine & HTMLString & Environment.NewLine)
                Console.WriteLine("--- Match ---" & Environment.NewLine & FindTextInSpan(HTMLString, "firstspan", "text"))
	End Sub
        
        Public Shared Function FindTextInSpan(ByVal HTML As String, ByVal SpanId As String, ByVal LookFor As String) As String
        Dim m As Match = Regex.Match(HTML, "(?<=<span.+id=""" & SpanId & """.*>.*)" & LookFor & "(?=.*<\/span>)", RegexOptions.IgnoreCase)
        Return If(m IsNot Nothing, m.Value, "")
    End Function
End Class