Code:
Sub test()
Dim str As String
str = "str 9999 9999 str"
Dim RegExp As Object
Set RegExp = CreateObject("vbscript.regexp")
With RegExp
.IgnoreCase = True
.MultiLine = False
.Pattern = "[!0-9]"
.Global = True
End With
output = RegExp.Replace(str, "")
MsgBox output
Set RegExp = Nothing
End Sub
I can't understand why [a-z] can extract the numbers but why [!0-9] can't.