I'm trying to solve a binary gap problem using regex and I'm having some problems getting it to work.
If I try something like this:
Number(101001000).toString().match(/(1[0]+1)/g)
It returns only ["101"]
, when I'm expecting ["101", "1001"]
.
Am I doing something wrong or it's not possible to achieve this result with regex only?