I need to output "Exceptional Innovation"

<div id="basic-info">
<h1 class="fn org">
<span>
Exceptional Innovation
</span>

Here's my Code

RichTextBox1.Text = htmlsource



        Dim myMatch As New System.Text.RegularExpressions.Regex("(?<=<div id=""basic-info""> <h1 class=""fn org""> <span>).+?(?<=</span>)", RegexOptions.IgnoreCase Or RegexOptions.Compiled)
        Dim matches As MatchCollection = myMatch.Matches(RichTextBox1.Text)

        For Each itemcode As Match In matches
            Dim output As String = (itemcode.Value.Split("""").GetValue(0))
            MsgBox(output)
        Next

Could somebody help me?

It works fine if I do something like this

Dim strsample = "345wq3453q245fgxh<div id=""basic-info""><h1 class=""fn org""><span>Exceptional Innovation</span>34535345345"




        Dim myMatch As New System.Text.RegularExpressions.Regex("(?<=<div id=""basic-info""> <h1 class=""fn org""> <span>).+?(?<=</span>)", RegexOptions.IgnoreCase Or RegexOptions.Compiled)
        Dim matches As MatchCollection = myMatch.Matches(strsample)

        For Each itemcode As Match In matches
            Dim output As String = (itemcode.Value.Split("""").GetValue(0))
            MsgBox(output)
        Next

But when I use the top most code I'm lost. Is there something wrong with my code or in the html source?

My solution is done in a Console app, but same logic applies to a WinForms app as well. If that isn't quite what you're looking for, please let me know so I can further assist you.

Module Module1

    Sub Main()
        Dim strsample As String = "<span>Exceptional Innovation</span>" 'Example string to get value from
        Dim openTag As String = "<span>", closeTag As String = "</span>" 'Create strings which store tags
        Dim index As Integer = strsample.IndexOf(openTag) 'Get index of the opening tag
        Dim index2 As Integer = strsample.IndexOf(closeTag) 'Get index of the closing tag
        Dim output As String = strsample.Substring(index + openTag.Length, 
index2 - index - openTag.Length) 'Get value between tags
        Console.WriteLine(output) 'I did this as a Console app so I output the result to the command line
        Console.ReadLine() 'Keep program open until return key is pressed
    End Sub

End Module
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.