I don't know if it'll meet your needs, but I usually validate phone
numbers by simply counting the number of digits.  For more advanced
stuff, just split the number at any non-digit character(s) and that'll
yield your parts (country, exchange, etc).

cheers,
barneyb

On Mon, 02 Aug 2004 19:48:29 +0200, Jochem van Dieten
<[EMAIL PROTECTED]> wrote:
> Matt Robertson wrote:
>
> > I'm trying to use this code and it keeps throwing out the string
> > whether its valid or not.  I know I'm doing something wrong but am a
> > dilettante at best when it comes to regexes.  I also tried Ben Forta's
> > phone regex out of his book with similarly bad results, so its
> > definitely me doing something stupid here.
> >
> > ThisRegex="[\(.]?[2-9]\d\d[\).]?[ -]?[2-9]\d\d[-.]\d{4}";
>
> How should a phone number look according to you? You appear to be
> after something else as the international standard ITU-T E.164.
> E164 is pretty much:
>
> phonenumber := "+" <CC> [" " <NDC>]" " <SN>
> <CC> := country code, 1-3 digits
> <NDC> := national destination code
> <SN> := subscriber number
>
> With the added restriction that <CC> + <NDC> + <SN> is 15 digits
> or less.
>
> Jochem
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to