function chkEmail(email) on error resume next dim i,l,pos1,pos2 chkEmail=true if isnull(email) then chkEmail=false:exit function pos1= instr(email,"@") pos2=instrRev(email,".") if not(pos10) or not (pos20) or pos1pos2 then chkEmail=false end if if err.number0&nbs...[ 查看全文 ]
正则表达式检查来访IP是否合法的实际应用 sub chkIP(boardid) dim rsIP dim ipArr dim ignored dim i dim ip dim sql ip=Request.ServerVariables("REMOTE_ADDR") ignored=false if not isempty(boardid) then sql="select ignoreip from board where boardid="&cstr(boardid...[ 查看全文 ]
代码例子如下: % Option Explicit Function stripHTML(strHTML) 'Strips the HTML tags from strHTML Dim objRegExp, strOutput Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True objRegExp.Pattern = ".+?" 'Replace all HTML tag matches with the empty string strOutput = objRegExp.Replace(strHTML, "") 'Replace all and with and strOutput = R...[ 查看全文 ]
首先,我们先看几个实际的例子: 1.验证输入字符是否 javascript: var ex = "^\\w+$"; var re = new RegExp(ex,"i"); return re.test(str); VBScript Dim regEx,flag,ex ex = "^\w+$" Set regEx = New RegExp regEx.IgnoreCase = True regEx.Global = True regEx.Pattern = ex flag = regEx.Test( str ) C# System.String ex = @"^\w+$"; System.Text.RegularExpressions.Rege...[ 查看全文 ]