Re: ereg problem

From: Date: Fri, 16 Feb 2001 23:01:19 +0000
Subject: Re: ereg problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40253@lists.php.net to get a copy of this message
In article <80B97DE95AEED311BA580050047FE98430D63F@mail.systech.com>, "Janet Valade" <janetv@systech.com> wrote: if you include a hyphen in a character class, it must be the last entry in the range, otherwise it is interepreted as the range separator. [0-9+.\()-] is what you want (probably have to escape some of the chars above). Jeff > I am using the following statement to check phone numbers. > > if (!ereg("^[0-9\-\+\.\ \)\(]{10,}$",$value)) { > > Can anyone tell me why this works for every character except the -. It > doesn't see the hyphen as a valid part of the phone number, even though > it recognizes the other characters, e.g. + or . > > Janet > >

« previous php.general (#40253) next »