I have a binary representation of a decimal:
1000010001
I want to match a sequence of consecutive zeros that is surrounded by ones at both ends, 10001
.
So in my string there are two such occurrences:
100001
10001
But for some reason match
with g
returns only the first:
'1000010001'.match(/(?:10+1)+/ig)
> ["100001"]
Why not both? How to make it return all occurrences?