【发布时间】:2017-04-18 07:47:21
【问题描述】:
我想从网站中提取特定链接。
链接如下所示:
/topic/Funny/G1pdeJm
链接总是相同的 - 除了最后一个随机字符。
我很难把这些部分结合起来
(preg_match("/^http:\/\//i",$str) || is_file($str))
和
(preg_match("/Funny(.*)/", $str) || is_file($str))
第一个代码提取每个链接 第二次从链接中提取仅 /topic/Funny/* 部分。
不幸的是我不能合并它们,我也想屏蔽这些标签:
/topic/Funny/viral
/topic/Funny/time
/topic/Funny/top
/topic/Funny/top/week
/topic/Funny/top/month
/topic/Funny/top/year
/topic/Funny/top/all
有什么想法吗?
谢谢,奇姆
【问题讨论】:
标签: php regex filtering extract