/ ^(0|1)$ # simple cases of 1 or 0, with zero 01|10 | ^1(0|1)*1$ # 1 .. anything .. 1 | ^0(0|1)*0$ # 0 .. anything .. 0 /x