On Sat, 18 May 2002, andy wrote:
> 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
> does anybody know whats wroong with that?

For one thing, your regex doesn't match any definition of "website 
address" that I've ever seen.

Look up the spec for URLs at http://www.w3.org/Addressing/ .

In the very least, you should not arbitrarily exclude valid domains just 
because the last part is not 2 or 3 characters - what about .info, 
.museum, etc.? And what's the @ for? 

As for your error, I'd guess it's because you wrote [0-9a-z-\.] rather 
than [0-9a-z\-\.] (escaping the -).


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to