How to validate a domain name using Regex & Php?

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-06-12T00:00:54Z Indexed on 2010/06/12 0:02 UTC
Read the original article Hit count: 267

Filed under:
|
|

Hi,

I want a solution to validate only domain names not full urls, The following example is what i'm looking for:

domain.com -> true
domain.net/org/biz... -> true
domain.co.uk -> true
sub.domain.com -> true
domain.com/folder -> false
domµ*$ain.com -> false

Thank you

© Stack Overflow or respective owner

Related posts about php

Related posts about regex