<%
str="sdkfjs中国"
Function isValidName(str)
Dim re
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
re.Pattern = "^[a-z0-9A-Z_]+$"
isValidName = re.Test(str)
Set re = Nothing
End Function
if isValidName(str)=false then
response.Write " <script language=javascript>alert('注册用户名内不能包含汉字!');history.go(-1); </script>"
end if
%>
我这样写 怎么还是实现不了啊 总提示 "注册用户名内不能包含汉字"
Function isValidName(str)
Dim re
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
re.Pattern = "^[a-z0-9A-Z_]+$"
isValidName = re.Test(str)
Set re = Nothing
End Function
'----------------------------------------------------------------'
' isValidName
' 检测用户名,0-9、a-z 和 _ 的组合,不区分大小写
' 参数:
' str 需要被检测的输入字符串
' 返回值:布尔 (如果输入的用户名合法,则返回 True,否则返回 False)
'---------------------------------------------------------'
Function isValidName(str)
Dim re
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
re.Pattern = "^[a-z0-9A-Z_]+$"
isValidName = re.Test(str)
Set re = Nothing
End Function