Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
-1 byte by jezza_99 / DLosc
aR`0+`#_aR+X0#_
Wow pip is really good at regex
Try It Online!
aR`0+`#_aR+X0#_ aR`0+`aR+X0 Replace all occurrences of consecutive(regexified zeros zero with a +) #_ with it's length
aR`0+`#_
aR`0+`#_ aR`0+` Replace all occurrences of consecutive zeros #_ with it's length
aR+X0#_
aR+X0#_ aR+X0 Replace all occurrences of (regexified zero with a +) #_ with it's length