ASP : Regular Expression
Remove Weird characters.
Function strClean (strtoclean)
Dim objRegExp, outputStr
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "((?![a-zA-Z0-9s]).)+"
outputStr = objRegExp.Replace(strtoclean, "")
strClean = Trim(outputStr)
Set objRegExp = Nothing
End Function
Return on ly a number
Function retNumber (str)
Dim ore, r
Set ore = New Regexp
ore.IgnoreCase = True
ore.Global = True
ore.Pattern = "D"
r = ore.Replace(str, "")
if len(r) > 0 then
retNumber = clng(Trim(r))
else
retNumber = -1
end if
Set ore = Nothing
End Function
Reference
http://www.code-tips.com/2009/04/vbscript-string-clean-function-remove.html
https://www.tutorialspoint.com/vbscript/vbscript_reg_expressions