ASP如何判断字符串只含有英文和数字
来源:百度知道 编辑:UC知道 时间:2024/06/29 02:50:57
ASP如何判断字符串只含有英文和数字??
一旦含有其他字符,则报错提示!
一旦含有其他字符,则报错提示!
用正则表达式,凡是匹配[^a-zA-Z0-9]的就有问题,例子如下:
<%
str="abc@def"
Set regEx = New RegExp
regEx.Pattern = "[^a-zA-Z0-9]"
regEx.IgnoreCase = True
If regEx.Test(CStr(g)) Then
response.write "有非法字符"
Else
response.write "没有有非法字符"
End If
%>