[Solved] Failing Regex string thats correct


I don’t see the problem. The regex works in the Regex Hero online tester (including the capture group capturing "Beta")…

VB.NET Regex in Regex Hero Online

…and works in the following VB.NET snippet it generated (to which I added a Console.WriteLine call for clarity):

Dim strRegex as String = "Version:</b>\s*<span>(.*)\<"
Dim myRegex As New Regex(strRegex, RegexOptions.None)
Dim strTargetString As String = "<b>Version:</b>             <span> Beta </span>"

For Each myMatch As Match In myRegex.Matches(strTargetString)
    If myMatch.Success Then
        Console.WriteLine(myMatch.Groups(1).Value)
    End If
Next

The snippet outputs what you want:

Beta

5

solved Failing Regex string thats correct