^: Begin the match at the beginning 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 = { "A1a1039C", "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