91网首页-91网页版-91网在线观看-91网站免费观看-91网站永久视频-91网站在线播放

LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發(fā)文檔 其他文檔  
 
網(wǎng)站管理員

常用的ASP正則過濾函數(shù) 可過濾html js style div font

admin
2010年7月22日 21:52 本文熱度 5266
開發(fā)程序,經(jīng)常要用到正則表達式進行過濾一些不需要的東西,比如html js style div font,有時候需要過濾極個別的,有時候需要過濾好幾種,不管怎么過濾,萬變不離其宗。[br][br] 這是我收藏的一些過濾函數(shù),可以用來過濾您不需要的代碼。如果需要過濾多種,可以嵌套使用,也可以自己整合代碼。不過不建議嵌套使用,因為那樣效率太低。[br][br][br]asp 正則表達式 過濾 所有 html 標記 :[br][br]
[img]images/code.gif[/img] 程序代碼
function losehtml(contentstr)[br]dim clstemplosestr,regex[br]clstemplosestr = cstr(contentstr)[br]set regex = new regexp[br]regex.pattern = "<\/*[^<>]*>"[br]regex.ignorecase = true[br]regex.global = true[br]clstemplosestr = regex.replace(clstemplosestr,"")[br]losehtml = clstemplosestr[br]end function[br][br]asp 正則表達式 過濾 style 標記 :[br][br]
[img]images/code.gif[/img] 程序代碼
function losestyletag(contentstr)[br]dim clstemplosestr,regex[br]clstemplosestr = cstr(contentstr)[br]set regex = new regexp[br]regex.pattern = "(]*>[^\0]*(<\/style>)+"[br]regex.ignorecase = true[br]regex.global = true[br]clstemplosestr = regex.replace(clstemplosestr,"")[br]losestyletag = clstemplosestr[br]set regex = nothing[br]end function[br][br][br]asp 正則表達式 過濾 層 div 標記 :[br][br]
[img]images/code.gif[/img] 程序代碼
function losedivtag(contentstr)[br]dim clstemplosestr,regex[br]clstemplosestr = cstr(contentstr)[br]set regex = new regexp[br]regex.pattern = "<(\/){0,1}div[^<>]*>"[br]regex.ignorecase = true[br]regex.global = true[br]clstemplosestr = regex.replace(clstemplosestr,"")[br]losedivtag = clstemplosestr[br]set regex = nothing[br]end function[br][br][br]asp 正則表達式 過濾 鏈接 a 標記 :[br][br]
[img]images/code.gif[/img] 程序代碼
function loseatag(contentstr)[br]dim clstemplosestr,regex[br]clstemplosestr = cstr(contentstr)[br]set regex = new regexp[br]regex.pattern = "<(\/){0,1}a[^<>]*>"[br]regex.ignorecase = true[br]regex.global = true[br]clstemplosestr = regex.replace(clstemplosestr,"")[br]loseatag = clstemplosestr[br]set regex = nothing[br]end function[br][br][br]asp 正則表達式 過濾 字體 font 標記 :[br][br][br]
[img]images/code.gif[/img] 程序代碼
function losefonttag(contentstr)[br]dim clstemplosestr,regex[br]clstemplosestr = cstr(contentstr)[br]set regex = new regexp[br]regex.pattern = "<(\/){0,1}font[^<>]*>"[br]regex.ignorecase = true[br]regex.global = true[br]clstemplosestr = regex.replace(clstemplosestr,"")[br]losefonttag = clstemplosestr[br]set regex = nothing[br]end function[br][br][br][br]asp 正則表達式 過濾 span 標記 :[br][br]程序代碼[br]function losespantag(contentstr)[br]dim clstemplosestr,regex[br]clstemplosestr = cstr(contentstr)[br]set regex = new regexp[br]regex.pattern = "<(\/){0,1}span[^<>]*>"[br]regex.ignorecase = true[br]regex.global = true[br]clstemplosestr = regex.replace(clstemplosestr,"")[br]losespantag = clstemplosestr[br]set regex = nothing[br]end function[br][br][br][br]asp 正則表達式 過濾 object 標記 :[br][br][br]
[img]images/code.gif[/img] 程序代碼
function loseobjecttag(contentstr)[br]dim clstemplosestr,regex[br]clstemplosestr = cstr(contentstr)[br]set regex = new regexp[br]regex.pattern = ""[br]regex.ignorecase = true[br]regex.global = true[br]clstemplosestr = regex.replace(clstemplosestr,"")[br]loseobjecttag = clstemplosestr[br]set regex = nothing[br]end function[br][br][br]asp 正則表達式 過濾 iframe 標記:[br][br]
[img]images/code.gif[/img] 程序代碼
function loseiframetag(contentstr)[br]dim clstemplosestr,regex[br]clstemplosestr = cstr(contentstr)[br]set regex = new regexp[br]regex.pattern = "(]*>[^\0]*(<\/iframe>){1,}"[br]regex.ignorecase = true[br]regex.global = true[br]clstemplosestr = regex.replace(clstemplosestr,"")[br]loseiframetag = clstemplosestr[br]set regex = nothing[br]end function[br][br][br]asp 正則表達式 過濾 script :[br][br]
[img]images/code.gif[/img] 程序代碼
function losescripttag(contentstr)[br]dim clstemplosestr,regex[br]clstemplosestr = cstr(contentstr)[br]set regex = new regexp[br]regex.pattern = "(]*>[^\0]*(<\/script>){1,}"[br]regex.ignorecase = true[br]regex.global = true[br]clstemplosestr = regex.replace(clstemplosestr,"")[br]losescripttag = clstemplosestr[br]set regex = nothing[br]end function[br][br][br]asp 正則表達式 過濾 class 標記 :[br][br]
[img]images/code.gif[/img] 程序代碼
function loseclasstag(contentstr)[br]dim clstemplosestr,regex[br]clstemplosestr = cstr(contentstr)[br]set regex = new regexp[br]regex.pattern = "(class=){1,}(""|\'){0,1}\s+(""|\'|>|\s){0,1}"[br]regex.ignorecase = true[br]regex.global = true[br]clstemplosestr = regex.replace(clstemplosestr,"")[br]loseclasstag = clstemplosestr[br]set regex = nothing[br]end function[br][br][br][br]字符串替換 replace 的正則表達式 :[br][br][br]
[img]images/code.gif[/img] 程序代碼
<%function replacereg(str,patrn,replstr,ignor)[br]'=========================================[br]'參數(shù)解釋:[br]'str 原來的字符串[br]'patrn 要替換的字符串(正則表達式)[br]'replstr 要替換成的字符串[br]'ignor 是否區(qū)分大小寫(1不區(qū)分,0區(qū)分)[br]'=========================================[br]dim regex ' 建立變量。[br]if ingor=1 then ingor=true else ingor=false[br]set regex = new regexp ' 建立正則表達式。[br]regex.pattern = patrn ' 設(shè)置模式。[br]regex.ignorecase = ignor ' 設(shè)置是否區(qū)分大小寫。[br]regex.global=true[br]replacereg = regex.replace(str,replstr) ' 作替換。[br]end function[br][br]'例如 將 weblank.com 替換成 weblank.com[br]response.write(replacereg("weblank.com","www\.weblank\.com","weblank.com",1))[br][br]%>

該文章在 2010/7/22 21:52:07 編輯過
關(guān)鍵字查詢
相關(guān)文章
正在查詢...
點晴ERP是一款針對中小制造業(yè)的專業(yè)生產(chǎn)管理軟件系統(tǒng),系統(tǒng)成熟度和易用性得到了國內(nèi)大量中小企業(yè)的青睞。
點晴PMS碼頭管理系統(tǒng)主要針對港口碼頭集裝箱與散貨日常運作、調(diào)度、堆場、車隊、財務(wù)費用、相關(guān)報表等業(yè)務(wù)管理,結(jié)合碼頭的業(yè)務(wù)特點,圍繞調(diào)度、堆場作業(yè)而開發(fā)的。集技術(shù)的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業(yè)的高效ERP管理信息系統(tǒng)。
點晴WMS倉儲管理系統(tǒng)提供了貨物產(chǎn)品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質(zhì)期管理,貨位管理,庫位管理,生產(chǎn)管理,WMS管理系統(tǒng),標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務(wù)都免費,不限功能、不限時間、不限用戶的免費OA協(xié)同辦公管理系統(tǒng)。
Copyright 2010-2025 ClickSun All Rights Reserved

主站蜘蛛池模板: 不卡线欧美 | 午夜影视在线播 | 国产乱子伦电视 | 精品国产乱 | 三级a三级三级 | 日韩一区欧美亚洲 | 日本免费亚洲视频 | 国产精品第一二三区 | 日韩精品二三区 | 国产亚洲人成 | 日韩欧美中文在线 | 日韩视频在线免费 | 区免费97 | 日韩精品免费网站 | 日韩精品在线电影 | 成人福利在线91 | 成人色综合网 | 日本有码中文 | 日韩亚洲人成影院 | 情ss综合网 | 激情图区就去干 | 午夜福利体验区 | 国产拳头交一 | 国产精品精品 | 午夜在线观看亚 | 欧美亚日韩精品影视 | 国产伦精品一区二区 | 日韩在线1区精品 | 国外精品 | 午夜福利精品一区 | 国产在线啊v观看不 | 国产自产在线观 | 三极国产精品 | 无码精品人妻一区二区三区影院 | 日韩经典| 国产精品偷伦视频免 | 97成人视屏 | 国产婷婷综合在 | 国产sm重味 | 日韩爽歪歪免费视频 | 日本欧美一 |