I want to extract all 0s between two 1s and group them from a binary number. So far I've done this,
529.to_s(2).scan(/1(0+)1/)
the output is array with one element only, although i want two elements. That is
529 => binary => 1000010001
["0000","000"]
529.to_s(2).scan /0+/matches one or more zeros regardless of the presence of ones. In any case, a binary number contains only zeros and ones. So the only other thing zeros could be surrounded is ones.