Your reg-ex wouldn't quite work. Remember, .info, .name, .coop and other new TLDs are out or are coming out soon. A limit of {2,3} would rule them all out as invalid.
It's only really possible if you have a list of all available TLDs and compare in part to that. There are like 130 TLDs too, so it's not the most practical thig in the world. Mike Frazer "Jeff Sheltren" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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. > > if (ereg("^[a-zA-Z]+\\.[a-z]{2,3}$", $var)) { > // valid domain > } > else{ > // not valid > } > > Jeff > > At 07:59 AM 2/5/2002 -0800, Brandon Orther wrote: > >Hello, > > > >Does anyone know a function or how I could make a function to check a > >variable for being a valid domain name without the "www. <http://www./> > >" In fron of it? > > > >Ex. $var = "mynewdomain.com" that would be TRUE > > > >Ex2. $var = "www.mynewdomain.com" that would be FALSE > > > >Ex3. $var = "My Great Domain" that would be FALSE > > > >And so on. > > > >Does anyone have a function that makes sure there are no illegal > >characters and there is a period in the middle of the text? > > > > > >-------------------------------------------- > >Brandon Orther > >WebIntellects Design/Development Manager > >[EMAIL PROTECTED] > >800-994-6364 > >www.webintellects.com > >-------------------------------------------- > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php