Re: need help on a ereg stmt. validating website adress

From: Date: Sat, 18 May 2002 15:38:30 +0000
Subject: Re: need help on a ereg stmt. validating website adress
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-98264@lists.php.net to get a copy of this message
> "andy" <news.letters@gmx.de> wrote: > > > Hi there, > > > > I would like to validate a website adress. Unfortunatelly my eregi stmt does > > not work: > > > > if (eregi("^@([0-9a-z][0-9a-z-\.]+)\.([a-z]{2,3}))", $website)){ // not a > > link > > > > I am getting the error msg: > > Warning: REG_ERANGE in extend.inc on line 94 > > The second charset: [0-9a-z-\.] has an errant hyphen (-). In this case > the hyphen should be the first or last character. Also, the . char loses > its meaning inside square brackets, so you don't need to escape it. > Eg: [0-9a-z.-] > > -- > Richard Heyes > ___________________________________________________________ > This mail sent using V-webmail - http://www.v-webmail.co.uk > I did change the comment to what you suggested: if (eregi("^@([0-9a-z][0-9a-z-.]+)\.([a-z]{2,3}))", $website)){ // not a link but this seams not to work as well. It is still possible to post a website like this: http://website So somehow the last part does not work checking for dot and 2 or 3 char. does somebody have an idea on that? Thanx, Andy

« previous php.general (#98264) next »