我有这样的preg_match规则:的preg_match问题
preg_match('#(http:\/\/(www.)?imgur.com)\/(gallery\/)?(([-|~_0-9A-Za-z]+)&?.*?)#i', $link, $matches)
这场比赛对于
http://imgur.com/xxxx
http://www.imgur.com/xxxx
http://imgur.com/gallery/xxxx
我怎么能避免以配合imgur.com/a/xxxx#xxxx
?
什么不应该匹配? '/ a /'? '#xxxx'?都?只有一起或独立? – 2011-04-19 00:11:42
将匹配所有之前,只是为了避免/ a/ – greenbandit 2011-04-19 00:13:57
你匹配的字符串或试图找到它在另一个字符串?它似乎是前... – alex 2011-04-19 00:24:43