ASP高手请进! replace 正则表达式
发布网友
发布时间:2022-04-23 10:16
我来回答
共3个回答
热心网友
时间:2022-04-23 11:46
代码如下:有问题hi我
<%
str="<a href=""1.asp?n=你&s=m"" target=""_blank"">你</a>" _
+"<a href=""2.asp?n=好&s=m"" target=""_blank"">好</a>"_
+"<a href=""3.asp?n=吗&s=m"" target=""_blank"">吗</a>"
set reg=new RegExp
reg.Pattern="<.+?>"
reg.global=true
str=reg.replace(str,"")
response.write str
%>
热心网友
时间:2022-04-23 13:04
<%sText="<a href=""1.asp?n=你&s=m"" target=""_blank"">你</a><a href=""2.asp?n=好&s=m"" target=""_blank"">好</a><a href=""3.asp?n=吗&s=m"" target=""_blank"">吗</a>"
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "<\/?[a|A][^>]*>"
Set Matches = regEx.Execute(sText)
For Each Match in Matches
sText = Replace(sText,Match.Value,"")
Next
Set Matches = Nothing
Set regEx = Nothing
response.Write(sText)
%>
热心网友
时间:2022-04-23 14:38
那你就用这个正则:
(?:>)[^><\s]*(?:<)