热度 9|
<script language="vbscript">
'使用正则表达式验证String1是否匹配Pattern
Public Function Validation(Pattern, String1)
Dim RegExp1, Matches
'建立正则表达式
Set RegExp1 = New RegExp
'设置模式
RegExp1.Pattern = Pattern
'设置是否区分字符大小写
RegExp1.IgnoreCase = True
'设置全局可用性
RegExp1.Global = True
Matches = RegExp1.Test(String1)
Validation = Matches
End Function
'验证String1是否为中文,是则返回True,否则返回False
Public Function CheckIsEmpty(String1)
CheckIsEmpty = Validation("^[\u4e00-\u9fa5]+$", Trim(String1))
End Function
MsgBox ("我是中国人"&vbcrlf&"验证为:"&CheckIsEmpty("我是中国人"))
MsgBox ("you name?"&vbcrlf&"验证为:"&CheckIsEmpty("you name?"))
</script>
手机版|Archiver|Ee23时尚网 ( 粤ICP备09167417号-1 )
GMT+8, 2024-4-19 09:28
Powered by Discuz! X3.3
© 2001-2017 Comsenz Inc.