问一个正则
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> //匹配一个简单的URL $reg = '/(http:\/\/)?(.*\.)*[(com)|(cn)|(net)]/'; $str = 'www.baidu.com/1/2/3/4/5/6'; preg_match($reg, $str, $match); var_dump($match);