I want to match sequences of one 1 followed by one or more 0s and one 1 (101, 1001, 10001, etc.) and the opposite as well switching the ones and zeros (010, 0110, 01110, etc.)
I can match separately with the regexes "10+1" and "01+0" just fine, but I can't seem to combine them to match either of them in a single regex:
import re
match1 = re.findall('10+1', '10100100011000001')
match2 = re.findall('01+0', '10100100011000001')
match12 = re.findall('10+1|01+0', '10100100011000001')
print(match1 + match2)
print(match12)
The first print with the combined matches from both regexes gets all the matches I’m looking for: ['101', '10001', '1000001', '010', '010', '0110'], while the second print with the matches from the unified regex is missing half of them: ['101', '010', '0110'].
Where am I messing up?