How to write Python Regular Expression find repeating digits in a number?


The following code using Python regex to find the repeating digits in given string

Example

import re
result = re.search(r'(\d)\1{3}','54222267890' )
print result.group()

Output

This gives the output

2222

Updated on: 20-Feb-2020

477 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements