Write an expression that contains an even number of 0s or an odd number of 1s
I got it down to:
1*(01*01*)* + 0*10*(10*10*)*
where the first part represents an even number of 0s and the second part an odd number of 1s
However, there's supposed to be a simplified solution that I'm not seeing. Any tips?
+
for alternatives in regexp? AFAIK, that's only used in automata theory, not when programming. – Haymakersubstr_count()
? – Ruhnke^(1(11)*|(00)+)$
– PaulitaQ3
. – Bozcaada+
as binary operator is Union, and if it appears in supperscript form as unary operator that means repetition for one or more times. – Bozcaada0*1(0|10*1)*
is an even shorter regex for the odd-1s part – Attack