我需要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,最後一個。 –