Imports System.Text.RegularExpressions
Public Class Tester
Public Shared Sub Main
Dim source As String = "This 7. several 0.9 numbers"
Dim parser As New Regex( _
"[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?")
Dim sourceMatches As MatchCollection = _
parser.Matches(source)
Dim result As Double = CDbl(sourceMatches(1).Value)
Console.WriteLine(result.ToString())
End Sub
End Class
|