20分求一个正则表达式!

来源:百度知道 编辑:UC知道 时间:2024/05/31 19:57:38
我要提取一组超链接的字符串 全部是类似
<a href="http://action1.123456.com/action/item_detail-0db1-c4fac996afbeeb6b748214ad84616b24.html"

也就是说全部是类似
<a href="http://action1.123456.com/action/*********.html"

我就想把一个html文件中 属于这一类型的字符串全部提取出来,但是不知道这个正则式应该怎么去写 小弟是初学 很菜很菜的~~~
谢谢各位GGJJ了

好吧,随便写个

<script>
a='<a href="http://action1.123456.com/action/item_detail-0db1-

c4fac996afbeeb6b748214ad84616b24.html" >';
re=/\<a href=\"?(?:http:\/\/)?[^\s]*\"?/g;
while((rr=re.exec(a))!=null){
alert(rr);
}
</script>

.....
re=".*?http:\/\/action1\.123456.com\/action\/(.*?)\.html.*?"
...
可提取出(.*?)中的东西 成一数组
然后拼接字符串即可。

基本语言的正则都差不多

<a href=".*?"