Imports System
Imports System.Text.RegularExpressions
Public Module Module1
Sub WordsStartWith(ByVal str As String, ByVal expr As String)
Dim mc As MatchCollection = Regex.Matches(str, expr)
Dim word As Match
For Each word In mc
Console.WriteLine(word)
Next word
End Sub
Public Sub Main()
Dim str As String = "Stack VB sold net Safe c programming s saber S"
WordsStartWith(str, "\bS\S*")
End Sub
End Module
' run:
'
' Stack
' Safe
' S
'