I'm new to python and I'm trying to construct a list of tuples with the start and end indices for pattern matching in a string.
I need to match a pattern that starts with 2 consecutive 0s and ends with 2 consecutive 1s with some combo of 0s and 1s in between.
For example,
s = '00101010111111100001011'
With some type of operation returning,
[(0, 10), (15, 23)]
I can find multiple occurrences of a pattern in a string using,
ind = [(m.start(), m.end()) for m in re.finditer(pattern, s)]
I'm just not sure how to write the regular expression (i.e pattern) to output what I want.