I need to find the regex expression to find a same digit that repeats 4 or more times with grep.
for example valid match will be
1exampl1of1val3id1match1
22ad//13sf2qett2222
3333asdfccwerq3w+134er
What I tried was
grep -E '[1-9]{4,}' filename
I need to find the regex expression to find a same digit that repeats 4 or more times with grep.
for example valid match will be
1exampl1of1val3id1match1
22ad//13sf2qett2222
3333asdfccwerq3w+134er
What I tried was
grep -E '[1-9]{4,}' filename
You may use
grep -E '([0-9])(.*\1){3}' filename
See the regex demo
Details
([0-9]) - Group 1: a digit(.*\1){3} - Three repetitions of any 0 or more characters followed with the same digit as captured in Group 1.