python - Count max consecutive recurring groups in a string - Stack Overflow
Thu Jul 09 2020 13:14:43 GMT+0000 (Coordinated Universal Time)
Trying to apply findall on just a pattern will simply return a list of all instances where the pattern shows up, but does not join up instances of consecutive patterns. re.findall(f'(?:{p})+', s) performs this role, before max(map(len, matches)) // len(p) gives the highest number of consecutive repetitions
https://stackoverflow.com/questions/59746080/count-max-consecutive-re-groups-in-a-string
Comments