December 2012
Intermediate to advanced
316 pages
6h 51m
English
In this recipe, we will see how to use the back-referencing operator in order to validate telephone numbers. Suppose telephone numbers in a certain city follow the rule: a number must be of exactly eight digits, and the first and second digit must be the same.
For example, the valid numbers of the city may be 44005600, 88008700, and so on. If the number entered starts with a zero or has length less than eight, an error should be displayed. We will see how a short validation program may be written.
For creating the program that checks the validity of a telephone number according to the given criteria, proceed as follows:
tel_no with eight characters.Read now
Unlock full access