Python program to find out or detect the mobile number from the given paragraph or string

In this tutorial, we will see how to find out or detect the mobile/phone number from a given paragraph in the Python program. To solve this problem, we will use the re module in the Python program. A paragraph will be given by the user and we will find out the mobile number by using the Python programming language. Before using the re module, we will learn a little bit about re module.

what is the re module?

Python has an inbuilt re module which allows us to solve the various problem based on pattern matching and string manipulation.

Detect or find out the mobile number from the given paragraph or string in Python

We will take any paragraph from which we have to find a mobile number.

Python program:-

import re
paragraph='My name is Bipin Kumar. I am from East Champaran district. Currently, I am pursuing Mechanical Engineering from Motihari College of Engineering, Motihari. My contact number is +919852458339.  I love to spend my time to learn the Python program.'
print('mobile number-',


mobile number- +919852458339
  • Initially, we have included the re module in the program by using the import function. In the re module the symbol use for matching the integer value from a given string.
  • we all know that the mobile number is of twelve digits so the symbol in the above code we have taken twelve.
  • After doing these all steps we have finally printed the mobile number from the given paragraph.
  • Here, I have taken a small paragraph if you want to find the mobile number from a long paragraph then no problem just you have to replace the paragraph.

So Guy’s, I hope you find it useful.

Also read:

Leave a Reply

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