---
title: "asp服务端正则表达式验证输入内容格式"
author: "fengxu"
date: "2009-01-06T10:54:00Z"
tags: ["ASP"]
slug: "asp"
draft: false
lastmod: "2009-01-06T10:54:00Z"
id: 343518
url: "https://fengxu.iteye.com/blog/343518"
---

函数如下：

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

 

返回true或者flase。值需要更换表达式：regEx.Pattern = "&lt;.+?&gt;" 中的&lt;.+?&gt;的就可以