Re: Trying to check for a valid URL String.

From: Date: Mon, 15 Dec 2003 03:34:08 +0000
Subject: Re: Trying to check for a valid URL String.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-172708@lists.php.net to get a copy of this message
"Philip J. Newman" <NewmanPj@PhilipNZ.com> wrote in message news:007d01c3c1d3$c94924a0$0401a8c0@jupiter... > so far i got ... > if > (!ereg("^http:\/\/([_\.0-9a-zA-Z-]+\.)+[a-zA-Z]/i",$websiteUrl) > { On a quick glance, three things stand out: 1) You allow underscores in the website domain, but these are not valid characters for domain names. 2) You allow dashes in the first pattern, but do not escape the dash character. 3) You have not provided a quantifier to the top-level domain pattern: [a-zA-Z], so it is only looking for one character fits the class [a-zA-Z]. Hope that helps, Al

« previous php.general (#172708) next »