Extracting Cell Phone Numbers from Random Strings of variable length?

The basic data was basically of the type shown in the following picture.

Basic Data

The interesting thing about cell numbers is that almost all of them are of 10 digits, at least in India. Hence, a very simple logic was used to achieve results, as shown below:

Code Used

The logic being to first detect five consecutive numbers and then check if 10 digits that begin with the first five numbers are forming a valid mobile number.

I am not showing the results here, but it is quite obvious 10 digits representing the cell numbers were successfully extracted.

CA Vikram S. Mathur

15th July 2019 (22:10 Hours IST)

Published by CA Vikram S. Mathur (vbacoder1962)

Am a CA from Ahmedabad, Gujarat, India.

2 replies on “Extracting Cell Phone Numbers from Random Strings of variable length?”

Comments are closed.

%d bloggers like this: