当前位置: 首页 > 图文教程 > 网络编程 > 正则表达式 > 去除内容中的html

正则表达式
python 正则表达式 反斜杠(/)的麻烦和陷阱
利用正则表达式(只录入中文,数字,英文)
匹配中文的正则(GB2312/utf-8)
JavaScript 实现基础 正则表达式
正则表达式中\w不能识别中文
PHP 正则表达式验证中文的问题
php中utf-8编码下用正则表达式如何匹配汉字
PHP正则匹配图片并给图片加链接详解
PHP 正则表达式的几则使用技巧
PHP 正则表达式常用函数使用小结
常用正则表达式范例 方便表单验证
php 正则 不包含某字符串的正则表达式
用正则表达式表示不包含2950的字符串
用正则删除不包含某个字符串的行的代码
用正则表达式来判断素数的代码
关于表格的正则表达式讨论(表格)
[原创]通过脚本清空标签p中的class名和style
[原创]VBS中的正则表达式的用法大全
去html代码的正则 推荐
正则表达式的应用

正则表达式 中的 去除内容中的html


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 52 ::
收藏到网摘: n/a

<%
Option Explicit
Function stripHTML(strtext)
dim arysplit,i,j, strOutput
arysplit=split(strtext,"<")
if len(arysplit(0))>0 then j=1 else j=0
for i=j to ubound(arysplit)
if instr(arysplit(i),">") then
arysplit(i)=mid(arysplit(i),instr(arysplit(i),">")+1)
else
arysplit(i)="<" & arysplit(i)
end if
next
strOutput = join(arysplit, "")
strOutput = mid(strOutput, 2-j)
strOutput = replace(strOutput,">",">")
strOutput = replace(strOutput,"<","<")
stripHTML = strOutput
End Function

%>
<form method="post" id=form1 name=form1>
<b>Enter an HTML String:</b><br>
<textarea name="txtHTML" cols="50" rows="8" wrap="virtual"><%=Request("txtHTML")%></textarea>
<p>
<input type="submit" value="Strip HTML Tags!" id=submit1 name=submit1>
</form>
<% if Len(Request("txtHTML")) > 0 then %>
<p><hr><p>
<b><u>View of string <i>with no</i> HTML stripping:</u></b><br>
<xmp>
<%=Request("txtHTML")%>
</xmp><p>
<b><u>View of string <i>with</i> HTML stripping:</u></b><br>
<pre>
<%=StripHTML(Request("txtHTML"))%>
</pre>
<% End If %>