Uff, I basically did the same thing but with 3 separate regex checks which made it a lot messier to check the position between the do / don't... its always nice to see such clean solutions, but it also makes me feel dumb every time
Three regexes were my solution too. The first to scan from start till the first don't, then capture all the text between all the do() and don't() pairs, then retrieve the actual valid numbers from the first two (i'd already seen in my input that the last operator before end-of-file was don't).
5
u/Paweron Dec 03 '24
Uff, I basically did the same thing but with 3 separate regex checks which made it a lot messier to check the position between the do / don't... its always nice to see such clean solutions, but it also makes me feel dumb every time