VB.Net Tutorial/Regular Expressions/MatchCollection — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 15:57, 26 мая 2010
Use MatchCollection
<source lang="vbnet">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</source>
0.9