A regular expression, often called a pattern, is an expression that describes a set of strings. They are usually used to give a concise description of a set, without having to list all elements.
The regular expression language is designed and optimized to manipulate text. The language comprises two basic character types: literal text characters and metacharacters.

Visual Studio Editor Regular Expression


^:b*   match leading white space


Example: Scanning for HREFs


Sub DumpHrefs(inputString As String)
	Dim r As Regex
	Dim m As Match
	
	r = New Regex("href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))", _
	RegexOptions.IgnoreCase Or RegexOptions.Compiled)
	
	m = r.Match(inputString)
	While m.Success
		Console.WriteLine("Found href " & m.Groups(1).Value _
		& " at " & m.Groups(1).Index.ToString())
		m = m.NextMatch()
	End While
End Sub

Example: Changing Date Formats


Function MDYToDMY(input As String) As String
	Return Regex.Replace(input, _
		"\b(?\d{1,2})/(?\d{1,2})/(?\d{2,4})\b", _
		"${day}-${month}-${year}")
End Function

Find SQL script comment


\/\**:bObject([^\>]*)\**\/