正则表达式,提取网页中的链接地址
程序员文章站
2022-03-27 10:05:52
<td class=cate width="45%" style="word-break:break-all">
<a class=m href="http://jmfengcai.cn.alibaba.com/athena/companydetail/jmfengcai.html" onmousedown="return aliclick(this,'?alishop=companylistcompanyname');" target="_blank" class=m>江门市蓬江区凤彩工艺厂</a>
<br>
代码如上.我请问如何用正则表达式,把"http://jmfengcai.cn.alibaba.com/athena/companydetail/jmfengcai.html"提取出来?
/(http:\/\/\[^" ']+)/gm
/href *= *['"]*(\s+)["']* */gm
根据不同需要选择。
<a class=m href="http://jmfengcai.cn.alibaba.com/athena/companydetail/jmfengcai.html" onmousedown="return aliclick(this,'?alishop=companylistcompanyname');" target="_blank" class=m>江门市蓬江区凤彩工艺厂</a>
<br>
代码如上.我请问如何用正则表达式,把"http://jmfengcai.cn.alibaba.com/athena/companydetail/jmfengcai.html"提取出来?
复制代码 代码如下:
/(http:\/\/\[^" ']+)/gm
/href *= *['"]*(\s+)["']* */gm
根据不同需要选择。
上一篇: 移除HTML标签的正则表达式
推荐阅读
-
php正则表达式如何获取内容中的视频地址和标题急
-
php使用正则表达式提取字符串中尖括号、小括号、中括号、大括号中的字符串
-
PHP提取字符串中的图片地址[正则表达式]_PHP
-
foreach - PHP 导入文本文件的正则表达式提取部分内容 变成数组 然后存入到mysql数据库中
-
PHP过滤和替换提交信息中的链接URL地址
-
使用PHP提取视频网站页面中的FLASH地址的代码_PHP
-
foreach - PHP 导入文本文件的正则表达式提取部分内容 变成数组 然后存入到mysql数据库中
-
使用PHP提取视频网站页面中的FLASH地址的代码_php技巧
-
Python提取网页中超链接的方法
-
Python提取网页中超链接的方法