仅检索数字并忽略字符串中的字母

Retrieve only numbers and ignore alphabets from String

我有 10A 或 20B 这样的字符串。我想要 10A 中的 10 个或 20B 中的 20 个。如何使用 VBScript 或 QTP 内部命令从字符串中仅拆分数字?

我会使用正则表达式:

s = "20B"

Set re = New RegExp
re.Pattern = "^\d+"

For Each m In re.Execute(s)
  num = CInt(m)
Next

WScript.Echo num