I am finding it difficult to write regex expression. Need your help in getting expected output.
import re
pattern1=r'(d)1{1,}'
s = '1222311'
c=re.finditer(pattern,s)
for i in c:
print(i.__getitem__(0))
I managed to get repeating digit but not able to get non repeating digit.
How to frame regex to get non repeating digits and repeating digits.
s = '1222311'
Expected output
Repeating digit : 222 , 11
Non Repeating digit : 1,3
New contributor
quora question is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.