I am trying to match the pattern "4 or more consecutive repeated digits". I know that the regex expression "(\d)\1{3}" works for this purpose as tested in https://regexr.com/. However the following code is not generating pattern match for any of the formulations:
import re
test_number = "5133336789123456"
pattern_1 = re.compile("(\d)\1{3}")
pattern_2 = re.compile("(\d)(\1{3})")
pattern_3 = re.compile(r"(\d)\1{3}")
pattern_4 = re.compile(r"(\d)(\1{3})")
print(pattern_1.match(test_number))
#None
print(pattern_2.match(test_number))
#None
print(pattern_3.match(test_number))
#None
print(pattern_4.match(test_number))
#None
What piece of this valid regex expression does not translate for Python regex?