Re: Check if var is a domain name

From: Date: Wed, 06 Feb 2002 10:10:23 +0000
Subject: Re: Check if var is a domain name
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-83691@lists.php.net to get a copy of this message
> Hi, I would use a regular expression to check it. This is a pretty general > one, but I think it should do the trick. It searches for 1 or more upper > or lowercase letters, followed by a literal dot, followed by 2 or 3 > lowercase letters. Of course there are valid domains that would not match > this (foobar.co.uk) for example, but it should work with the values you > specified. 1. Doesn't check every TLD as you acknowledge. 2. Doesnt't check validity as in the domain exists! If I wanted to check the domain was valid and existed I would do a Whois and NSLookup. Regards Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 PGP Key available, send email with subject: Send PGP Key

« previous php.general (#83691) next »