博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

asp服务端正则表达式验证输入内容格式收藏

Posted on 2009-03-16 16:43  ^_^木头人  阅读(93)  评论(0)    收藏  举报

 

函数如下:

Function jugdetel(htmlStr)
if not isnull(htmlStr) then
    Dim regEx
    SET regEx = New Regexp
    regEx.IgnoreCase = True  '设置是否区分字符大小写
    regEx.Global = True  '设置全局可用性
    regEx.Pattern = "<.+?>"   '设置模式
    jugdetel = regEx.Test(htmlStr)  '执行
    SET regEx = Nothing
 end if
End Function

 

返回true或者flase。值需要更换表达式:regEx.Pattern = "<.+?>" 中的<.+?>的就可以