开发者

PHP preg match *.domain.com or *.domain.co.uk

I'm开发者_运维百科 using this code to preg match for *.domain.com but need it changed to also include foreign domains which have a few periods like *.domain.co.uk. Any helps appreciated thanks

if (trim(preg_match('!^https?://([^/]+\.)?domain\.com(/|#|$)!i', $documentLink->getAttribute('href'))))

Just an update that i'm looking to match *.domain.(any TLD) not just co.uk

Thanks


!^https?://([^/]+\.)?domain(.com|co.uk)(/|#|$)!i


!^https?://([^/]+\.)?domain[.a-z]+(/|#|$)!i


!^(https?://)?([\w-]+\.)?domain(\.[a-z]{2,5})+(/|#|$)!i
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜