Finding Phone No, Email id and DOB using RegEX in python

Sowmiya K
Jun 30, 2023

--

firstly we need to import regular expression by using “import re”

Add text in which para need to find the pattern you want

create a pattern by using compile function, in the bracket added raw string to take the pattern as it is((r’[A-Za-z]+[-/]\d{2}[-/]\d{4}’)).

use finditer function to list all possible output or if you need single answer use search function instead of finditer and followed by for loop to execute.

Some of the characters which use to create pattern in RegEx,

To find all possible phone numbers:

To find all possible email id:

To find all possible dates:

--

--

Sowmiya K
Sowmiya K

Written by Sowmiya K

Working for HCL as a Senior Software Engineer | Interested in Networking | cybersecurity | Python

No responses yet