He joined the Information Strategies team in September 1997 and is now an independent consultant.He has written or contributed to "Visual Basic 6 Bible" (IDG Books Worldwide, 1998), "Using Visual Basic 6" (Que), and "Inside VBScript with Active X" (New Riders Press, 1997).While we won't deal with international (non-US) phone numbers here, you can apply these techniques to your local phone number format.
The extension found, if any, is added back to the number.
To try this code out, you can use any of these test cases to see the validation in action: The end result is that it makes data entry easier for the user.
Because the input type obscures the text typed, you should let the user confirm that they haven't made a mistake.
The simplest way to do this is to have the password entered twice, and then check that they are identical.
The code first removes all the grouping and separator characters, except for the X, which marks the beginning of an extension.