Mick White wrote:
<--snip-->
> A North American phone #
> function isNAPhone(userEntry){
> return /^1?{9]$/.test(userEntry.replace(/[^\d]/g,""))
> }
> However this is a very crude test (an optional 1 followed by 9 numbers,
> after non-numerical characters are stripped from the user entry), a
> return of "true" does not guarantee a valid phone number (actually, I
> don't think it's possible)
You could test it to see if it falls in the acceptable pattern, but to
tell if its a valid # or not, you would have to call it to see if it
gets answered
The Area Code got changed recently. At one time, it was always a 0 or 1
for the 2nd digit, I know of a 334 (Alabama). It also never starts with
a 0 or 1. So not sure what the exact rule is now :-\
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq