Imports System.Text.RegularExpressions
Public Class Tester
Public Shared Sub Main
Dim quote As String = "The important thing is not to " & _
"stop questioning. --Albert Einstein"
Dim parser As New Regex("\w+")
Dim totalMatches As Integer = parser.Matches(quote).Count
Console.WriteLine(quote & vbNewLine & "Number words: " & _
totalMatches.ToString)
End Sub
End Class
|