高分求正则表达式的解决方法,进来有分~~~~

ooponline 2006-06-04 04:57:44
如何能用正则表达式将<a class=l href="http://andrewteman.org/" target=_blank onmousedown="return clk(0,'','','res','2','')">andrewteman.org</a>
中的href中的连接和<a ..></a>中的这个连接文字取出来??
求一个实现过程,如果详细,单开一帖再送100分~~

着急,麻烦大家~~~
...全文
132 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
KylinChina 2006-06-05
  • 打赏
  • 举报
回复
我来了,帮你顶
dam520 2006-06-05
  • 打赏
  • 举报
回复
帮顶
ooponline 2006-06-05
  • 打赏
  • 举报
回复
TO:webphoenix()
怎么提取出$1 $2??
webphoenix 2006-06-04
  • 打赏
  • 举报
回复
dim string:strng = ="<a class=l href=""http://andrewteman.org/"" target=_blank onmousedown=""return clk(0,'','','res','2','')"">andrewteman.org</a>"
dim Reg:Set Reg = new regexp
reg.IgnoreCase = true
reg.global = true
reg.Pattern = "<a (?:[^>]*)href=""([^>]*)"">(.*)<\/a>"
Set Matches = reg.Execute(strng) ' 执行搜索。
...

$1是href,$2是<a..></a>之间的
wanghui0380 2006-06-04
  • 打赏
  • 举报
回复
(href)+=[^\s]+

先提取href="xx" 或href=xx 出来,剩下的事,你自己应该会做了把
ahcpx 2006-06-04
  • 打赏
  • 举报
回复
<span id=t><a class=l href="http://andrewteman.org/" target=_blank mousedown="return clk(0,'','','res','2','')">andrewteman.org</a>
</span>
<input type=button value=test onclick="alert(document.all.t.innerHTML.replace(/<.*?>/g,''))">
kafly 2006-06-04
  • 打赏
  • 举报
回复
<%
ssdoc="<a class=l href=""http://andrewteman.org/"" target=_blank onmousedown=""return clk(0,'','','res','2','')"">andrewteman.org</a>"

ssdoc=Right(ssdoc,len(ssdoc)-Instr(ssdoc,"href=""")-5)
response.write left(ssdoc,Instr(ssdoc,"""")-1)
%>

另一种根据href来找的

要找连接文字同理,根据</a>来找,不过反向
kafly 2006-06-04
  • 打赏
  • 举报
回复
<%
ssdoc="<a class=l href=""http://andrewteman.org/"" target=_blank onmousedown=""return clk(0,'','','res','2','')"">andrewteman.org</a>"

V= Split(ssdoc,"""")
For i = 0 To UBound(V)
if Instr(V(i),"http://") > 0 then
Response.Write V(i)&"<br/>"
exit for
end if
Next
%>
kafly 2006-06-04
  • 打赏
  • 举报
回复
这么简单的东西还要写正则吗?
ooponline 2006-06-04
  • 打赏
  • 举报
回复
以上面为例就是要分别取出,http://andrewteman.org/ 和 andrewteman.org这2项~~~

麻烦大家,正则高手来~~~

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧