ASP中怎么知道一串字符串是否位数字和A~Z

来源:百度知道 编辑:UC知道 时间:2024/05/24 10:58:14
ASP中怎么知道一串字符串是否位数字和A~Z
就是说用户输入了一串字符串,然后我想判断一下是否为数字+字母。
就这个功能!

这个东西应该就好是在javascript头判断。
if(/^\w*$/.test(txt1.value)){
通过验证,是数字+字母
}

Function inCharAndNum( strText )
Dim RegEx

Set RegEx = New RegExp

RegEx.Pattern = "[a-zA-Z0-9]g"
RegEx.Global = true

inCharAndNum= RegEx.test(strText )
End Function
//////////////////////////////////
response.write("<br>")
response.write inCharAndNum("aaaa@1!#@#") 'return false
response.write("<br>")
response.write inCharAndNum("a1gc")'return true