-1

I want my pattern to find every pair of any character with exactly one character in between. For example:

1212

should have 2 matches:

1212

1212

Another example:

00000

should have 3 matches:

00000

00000

00000

I have tried already r"(.).\1", but it works only for every 3 characters that weren't included in other match, so for 00000 example it just matches the first three 0s, like 00000. If the example was 000000 then it has 2 matches, first (000000) and last (000000) three 0s, instead of matching all 4 like I would like it to do.

I don't understand why is that happening and would love to get some help on that, should I modify somehow my regex, or maybe my approach to this is completely wrong?

Lasty
  • 1

0 Answers0