How to determine if a number is binary and has an even amount of zeros with only one regex?

^[1]*(0[1]*0[1]*)*$

which can be interpreted in the following way:

find any number of 1 followed by pairs of 00 with optional one or more 1s in between.

Leave a Comment