$ Matches the end of the input string.
Imports System.Text.RegularExpressions Module Example Public Sub Main() Dim pattern As String = "^\D\d{1,5}\D*$" Dim inputs() As String = { "A11111111C", "AaaaaA0001", "C111118A", "Y11111111" } For Each input As String In inputs If Regex.IsMatch(input, pattern) Then Console.WriteLine(input + ": matched") Else Console.WriteLine(input + ": match failed") End If Next End Sub End Module