---
title: "提取html中的超链接地址"
author: "姜太公"
date: "2008-11-03T18:57:38Z"
tags: ["HTML", "Perl", "正则表达式"]
slug: "html"
draft: false
lastmod: "2008-11-30T10:19:47Z"
id: 261808
url: "https://jjz.iteye.com/blog/261808"
---

正则表达式不易调试，写起来有趣，读起来烦。就像perl一样！

没怎么测试，不过应该凑合能用。

主角登场：

```
<a.*?\s+href=\s*"?([^\s">]+)[\s">]
```

 

其中\[^\\s"&gt;]最好替换成url字符集，可以防止意外情况出现。

 

使用的时候要忽略大小写