Imports System
Imports System.Text
Imports System.Text.RegularExpressions
Public Class MainClass
Shared Sub Main()
Dim string1 As String = "This is a test string"
Dim theReg As New Regex("(\S+)\s")
Dim theMatches As MatchCollection = theReg.Matches(string1)
Dim theMatch As Match
For Each theMatch In theMatches
Console.WriteLine("theMatch.Length: {0}", _
theMatch.Length)
If theMatch.Length <> 0 Then
Console.WriteLine("theMatch: {0}", _
theMatch.ToString( ))
End If
Next theMatch
End Sub
End Class