【发布时间】:2011-12-07 23:09:00
【问题描述】:
您好,我有这个正则表达式来匹配 ursl,但我也需要匹配子域。
public function getUrls($url){
preg_match_all( "#(www\.|https?:\/\/){1}[a-zA-Z0-9]{2,}\.[a-zA-Z0-9]{2,}(\S*)#i",$url, $matches );
return $matches[0];
}
此匹配 http://domain.com 但不是 http://sub.domain.com
知道如何让它工作吗?
【问题讨论】:
标签: regex preg-match-all subdomain