in reply to matching pattern question?
I think what you want is /^0*1{3,}0*$/.
Second Edit: After having re-read the question several times, I think what you might want is /^(0|1{3,})*1{3,}(0|1{3,})*$/