ASP如何验证注册用户为汉字?

偷麦 2009-11-05 09:25:03
ASP如何验证注册用户为汉字 如果注册用户里文本框传递过来的包括汉字就不让注册了 这个要怎么实现呢 ?
...全文
64 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
偷麦 2009-11-05
  • 打赏
  • 举报
回复
哦了 谢谢你
lzp4881 2009-11-05
  • 打赏
  • 举报
回复
<%
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
%>
偷麦 2009-11-05
  • 打赏
  • 举报
回复
我这样写 怎么还是实现不了啊 总提示 "注册用户名内不能包含汉字"
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
lzp4881 2009-11-05
  • 打赏
  • 举报
回复
'----------------------------------------------------------------'
' 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

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧