![](/img/trans.png)
[英]Regular expression pattern to match URL with or without http://www
[英]URl pattern Matching in php without http or www
我有一个HTML文件,其中包含一些链接,例如
<a href="clash/football/a-vs-b">
<a href="clash/football/dsfdsfds-vs-erer">
我用这个$regex_pattern = "/^[^.]+((\\.[^.\\/]{1,3}\\b){1,2}).*$/";
模式来查找这种类型的URL。 但是无法得到这个。 请有人帮我。 我需要匹配"<a href="clash/football/a-vs-b">"
类的总标签
正则表达式描述了对常规语言的操作,而html
不是常规语言! 使用DomDocument会更好。
然后,您可以查看getElementsByTagName
以获取所有<a href>
标记。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.