Imports System.Text.RegularExpressions Module Example Public Sub Main() Dim pattern2 As String = "\bgr(a|e)y\b" For Each match As Match In Regex.Matches("asdf", pattern2) Console.WriteLine("'{0}' found at position {1}", _ match.Value, match.Index) Next End Sub End Module