(0..255).each{|n| bin = n.to_s(2) puts "#{bin}" if /(?=^1*(01*0)*1*$)^.(..)*$/=~bin }
Standard input is empty
1 100 111 10000 10011 10101 10110 11001 11010 11100 11111 1000000 1000011 1000101 1000110 1001111 1010001 1010010 1010111 1011000 1011011 1011101 1011110 1100001 1100010 1100111 1101000 1101011 1101101 1101110 1110000 1110011 1110101 1110110 1111001 1111010 1111100 1111111