Preg_match_all lt;a href(Preg_match_all a href)
问题描述
你好,我想提取链接<a href="/portal/clients/show/entityId/2121" >我想要一个正则表达式,它给我/portal/clients/show/entityId/2121最后2121的数字在其他链接中不同有什么想法吗?
Hello i want to extract links
<a href="/portal/clients/show/entityId/2121" >
and i want a regex which givs me /portal/clients/show/entityId/2121
the number at last 2121 is in other links different
any idea?
推荐答案
解析链接的正则表达式是这样的:
Regex for parsing links is something like this:
'/<as+(?:[^"'>]+|"[^"]*"|'[^']*')*href=("[^"]+"|'[^']+'|[^<>s]+)/i'
鉴于这有多可怕,我建议至少使用 Simple HTML Dom 来获取链接.然后,您可以在链接 href 上使用一些非常基本的正则表达式来检查链接.
Given how horrible that is, I would recommend using Simple HTML Dom for getting the links at least. You could then check links using some very basic regex on the link href.
这篇关于Preg_match_all <a href的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Preg_match_all <a href
基础教程推荐
- php中的PDF导出 2022-01-01
- php中的foreach复选框POST 2021-01-01
- 将变量从树枝传递给 js 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- Web 服务器如何处理请求? 2021-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
