我需要重写以下PHP代码段(从提供的字符串中过滤掉任何非数字字符);
$new_string = preg_replace("/[^0-9]/", "", $old_string)
进入VBScript。有什么建议吗?
答案 0 :(得分:2)
Function repNum(myString)
Set RegularExpressionObject = New RegExp
With RegularExpressionObject
.Pattern = "[^0-9]"
.IgnoreCase = True
.Global = True
End With
repNum = RegularExpressionObject.Replace(myString, "")
Set RegularExpressionObject = nothing
End Function