* Thus wrote Albert Padley:
> I have been struggling with a javascript regex validation for U.S. 
> phone numbers all afternoon. This is part of Manuel Lemos' Formsgen 
> class. This is limited to the 7 digit number sans 3 digit area code. To 
> be complete, the regex should disallow a phone number that begins with 
> 0 or 1, 555 or any digit followed by 11. Here is the regex I'm using:
> 
> ^(?!\d[1]{2}|[5]{3})([2-9]\d{2})([-])\d{4}$

start yourself in a controlled environment, instead of trying to
comeup with the endless ways a number can be formated and remove
all non digits, then simply test the condistion of the string

  if substr(0,1) == 0 || substr(0,1) == 1
    fail
  if substr(0,3) == 555
    fail
  if substr(1,2) == 11
    fail
  if strlen != 7
    fail




Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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

Reply via email to