Asp实现检测字符串是否为纯字母和数字组合的函数

01
<%
02
'**
03
'函数:CheckString(strng)
04
'参数:strng,待验证字符串
05
'描述:检测字符串是否为纯字母和数字组合
06
'示例:CheckString(strng)
07
'**
08
Function CheckString(strng)
09
CheckString = true
10
Dim regEx, Match
11
Set regEx = New RegExp
12
regEx.Pattern = "^[A-Za-z0-9]+$"
13
regEx.IgnoreCase = True
14
Set Match = regEx.Execute(strng)
15
if match.count then CheckString= false
16
End Function
17
'**
18
'函数:CheckChinese(strng)
19
'参数:strng,待验证字符
20
'描述:检测是否为中文字符,返回值:中文为true,否则false
21
'示例:CheckChinese(strng)
22
'**
23
Function CheckChinese(strng)
24
CheckChinese = true
25
Dim regEx, Match
26
Set regEx = New RegExp
27
regEx.Pattern = "||#|\&|\?|\@|\%|*|\/|.|\,|\;|\'|\:|-|_|+|\^|\""|\=|\<|\>|\ "
28
regEx.IgnoreCase = True
29
Set Match = regEx.Execute(strng)
30
if match.count then CheckChinese= false
31
End Function
32
%>

本文原创自news.mkq.online

版权声明:本文为原创文章,版权牛站新闻所有
转载请注明http://www.niuzhan.com/keji/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章