Home / U s a hot xxx / Validating a phone number

Validating a phone number

Before we do that, though, let me digress and explain what’s going to happen in this validation process.

It must confirm that the first 3 characters are digits, a dash, 3 more digits, a dash, and then 4 more digits. etc.." but use loops to increment the index and continue checking as long as the number keeps abiding by the phone number format specified.

If we wanted to do that, we could create three (or four) form fields (one for each element) and restrict the length of those fields.

Then, on the server-side, we’d piece them together.

It is crucial to the integrity of data and to the security of an application to validate any input.

I believe that most pass off validation out of laziness, but, as you can see, validating a phone number only adds a few extra lines of code to your application.


  1. This is a Visual Basic code used to validate a phone number entered by a user if the phone number entered. Validate Phone Number- Regex.

Leave a Reply

Your email address will not be published. Required fields are marked *