Make a regex that matches certain binary numbers Your task is to create a regular expression that matches most binary numbers with an even number of 0s and an odd number of 1s (e.g. "101100011").

The full criteria for the regex are:


matches 90% or more of all binary numbers between 0 and 11111111 with even number of 0s and an odd number of
1s,
doesn't match 90% or more of all binary numbers between 0 and 11111111 with odd number of 0s or an even number of
1s,
works in most common programming languages.


Ideally, it should be short and creative.

The input string always has a length that is greater than 1, less than infinity, and only contains 1s and 0s.

I will upvote any answer that seriously attempts to match the above criteria. Once the activity around this question dies down, I'll accept the highest-voted answer that is at least only 1.333... times the length of the shortest answer.
The following regex

(?=^1*(01*0)*1*$)^.(..)*$


works in many languages. It performs a perfect match for any binary of arbitrary length.

Basically, it consists of two parts which are joined via and by using a lookahead pattern:


^1*(01*0)*1*$ matches if an even number of zeros is provided.
^.(..)*$ tests for an odd number of digits in total.


The test run can be seen here.