<% Function ReplaceReg(str,patrn,replStr,Ignor) '========================================= '更多资源请访问:www.ffasp.com '参数解释: 'str 原来的字符串 'patrn 要替换的字符串(正则表达式) 'replStr 要替换成的字符串 'Ignor 是否区分大小写(1不区分,0区分) '========================================= Dim regEx ' 建立变量 。 If Ingor=1 Then Ingor=true else Ingor=false Set regEx = New RegExp ' 建立正则表达式 。 regEx.Pattern = patrn ' 设置模式 。飞飞Asp技,术乐园 regEx.IgnoreCase = Ignor ' 设置是否区分大小写 。 regEx.Global=True ReplaceReg = regEx.Replace(str,replStr) ' 作替换 。End Function '例如 将 www.ffasp.com 替换成 <a href="http://www.ffasp.com">www.ffasp.com</a> Response.Write(ReplaceReg("www.ffasp.com","www\.ffasp\.com","<a href=""http://www.ffasp.com"">www.ffasp.com</a>",1)) %>
|