Re: Still REG EX

From: Date: Sun, 24 Mar 2002 00:35:39 +0000
Subject: Re: Still REG EX
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-89868@lists.php.net to get a copy of this message
On Sun, 24 Mar 2002, John Fishworld wrote: > I'm still playing about trying to validate an url > www(dot)something(dot)something ! > > I thought this would work but know > > if (ereg("^(w{3})(\\.)([a-zA-Z]+)(\\.)([a-z]{2,4})$", $str)) First of all, web server hostnames don't need to start with www. Secondly, they can have any number of components (separated by periods) from 1 to dozens. Thirdly, the last term doesn't have to be 4 characters or less. > ([a-z]{2,4})$ = at least 2 leters eg de but upto 4 eg info .museum... miguel

« previous php.general (#89868) next »