我需要preg_match
指向imgur.com服务的链接。 因此,我的代码是:Preg matching imgur.com链接
if (!preg_match("/(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}
(\/\$_POST['request'])) { ... }
如何使它只与这些链接一起工作?
http://imgur.com/aBc1
https://imgur.com/a/aBc1
http://www.imgur.com/a/aBc1
https://www.imgur.com/a/aBc1
http://imgur.com/gallery/aBc1
https://imgur.com/gallery/aBc1
http://i.imgur.com/aBc1.png(.jpg,.jpeg,.gif)
https://i.imgur.com/aBc1.png(.jpg,.jpeg,.gif)
你关心的所有捕获组?意思是说,你想访问URL中的任何值吗?或者你只需要知道它是或不是一个imgur网址? –
@PatrickQ,最后一个。 –