0
我需要重写下面的PHP代码片段(它从提供的字符串中过滤出任何非数字字符);VBScript替代PHP的preg_match
$new_string = preg_replace("/[^0-9]/", "", $old_string)
into VBScript。有什么建议么 ?
我需要重写下面的PHP代码片段(它从提供的字符串中过滤出任何非数字字符);VBScript替代PHP的preg_match
$new_string = preg_replace("/[^0-9]/", "", $old_string)
into VBScript。有什么建议么 ?
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
设置'IgnoreCase'是毫无意义的在这种情况下,有没有大写/小写数字,表达式与其他任何内容匹配。 –
看看这里:http://msdn.microsoft.com/en-us/library/ms974570.aspx –