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

主站蜘蛛池模板: 久热这里只有 | 日韩最新免 | 国产乱子夫妻 | 99re这里是国产 | 国产区第一页 | 成人人电影| 日本亚洲精品成人 | 日韩一级视频免费 | 韩国一区二 | 国产在线精品国自产 | 日本不卡网站 | 日本在线视频在线 | 女同另类之国产女同 | 国产女同女互慰 | 日韩免费视频 | 国产亚洲欧 | 日本成人HH慢 | 成人欧美一区二 | 日本韩国欧美 | 伦理片在线观看伦 | 国产特黄特 | 动漫精品H | 国产精品视频全 | 成人午夜福利免费 | 日本特级婬片免费 | 欧洲番茄影院 | 最新国产视频 | 成人精品视频 | 日本特大 | 日韩一级大片国产 | 欧美性XXXX | 国产尹人在线视 | 国产呦网站免費資訊 | 91福利在线视 | 国产激情视频 | 国产精品自拍一区 | 国产观看免费在线久 | 国产乱理伦片在 | 91短视频网址 | 欧洲综合国产在线 | 午夜爽片超清 |