Rearranging regex checks