May-14-2024, 01:04 PM
(This post was last modified: May-14-2024, 01:06 PM by Pedroski55.)
Quote:I am looking for a regex pattern to find the instance of 3 matching characters in series in a string.
This finds all instances of "3 matching characters in series", as stated above.
Is that NOT what you want?
string = 'AAAABBBBCCCC11212222333444455555666666' result = [match[0] for match in re.findall(r'((\w)\2{2,2})', string)]
Output:result
['AAA', 'BBB', 'CCC', '222', '333', '444', '555', '666', '666']