<%
Dim Input, Disallowed
' String to clean
Input = "sjsvnw)68&Y469$T_W$(*T+}D|3567808SDK49SO" & _
"DJ0570570Gosdnp SNDFG_S(*GH-S570570GN*4 jwt jtj+W$T )"
' Allow spaces, underscores and any integer or letter of the alphabet.
' Remove anything else...
Disallowed = "[]+=)(*&^%$#@!|\/?><,{}:;.-~`'" & chr(34) & vbCrLf & vbTab
Response.Write RmChr(Input, Disallowed) & "<BR>"
' remove spaces, tabs, linefeed carriagereturns...
Disallowed = " " & vbTab & vbCrLf
Response.Write RmChr(Input, Disallowed) & "<BR>"
' remove numbers...
Disallowed = "0123456789"
Response.Write RmChr(Input, Disallowed) & "<BR>"
' remove lower case letters...
Disallowed = lcase("abcdefghijklmnopqrstuvwxyz")
Response.Write RmChr(Input, Disallowed) & "<BR>"
' remove upper case letters...
Disallowed = ucase("abcdefghijklmnopqrstuvwxyz")
Response.Write RmChr(Input, Disallowed) & "<BR>"
%>
<%
Private Function RmChr(byVal string, byVal remove)
Dim i, j, tmp, strOutput
strOutput = ""
for j = 1 to len(string)
tmp = Mid(string, j, 1)
for i = 1 to len(remove)
tmp = replace( tmp, Mid(remove, i, 1), "")
if len(tmp) = 0 then exit for
next
strOutput = strOutput & tmp
next
RmChr = strOutput
End Function
%>