Transform 7-segment display pattern into number
Ruby, 151 characters

s,*r=*$&lt;;c=r[s=s.to_i]
i=0;(n=(r[0][i+1]+c[i]+c[i+s,2]+r[-1][i]).tr(" |_","01").to_i 2
$&gt;&lt;&lt;(0..9).find{|j|0x3df9778eb5c5b&gt;&gt;5*j&amp;31==n};i+=s+2)while b[i]


Leaves out digits it cannot recognise, but some invalid digits are recognised nevertheless.

Assumes the lines are padded with spaces to their full length.