1' Needs reference "Microsoft VBScript Regular Expressions 5.5"
2Dim rRegex As Object
3Set rRegex = CreateObject("VBScript.RegExp")
4
5rRegex.Pattern = "[0-9]{8,9}" ' 8 or 9 numbers
6MsgBox rRegex.test("12345678") ' True
7
8rRegex.Pattern = "[0-9]+" ' Numeric of any size
9MsgBox rRegex.test("12345") ' True
1For matching an integer number of one single char/digit, specify:
2[0-9]
3But for matching any number of more than one char/digit; add "+":
4[0-9]+
5Example for matching hour with minutes of HH:MM format in a file:
6grep "[0-9]\+\:[0-9]\+" file.txt