I just started learning about formal lang and automata theory, and recently learned about regex, so I don't know any complicated symbols, so please stick with basic symbols.
The question is: Write a regex for the following language over {0,1} that is a set of all odd length strings that contain exactly two 0's.
I've got the first part finished (the odd part), it should be:
(0+1)[(0+1)(0+1)]* ( + is the same as | (or) I believe, we learnt it as +)
However, when I think about having exactly two 0's it gets really messed up. I can only see that I can use * with 1 only since # of 0's are limited to 2. But if i do (11)* , I can't get the permutation of 0's inside the 1's. (e.g. can't get 10101 with (11)*).
What I know:
- Only 1's can use *
- In the regex only two 0's will be used
- The way to make odd length is to add an odd length to an even length (even length needs to have empty string within it's set)
- Odd length should not use * since 2 odd = even, so only even length can use *
For possible hints or answer, please use 0,1,+/|,*,(,) only. Some other expressions I will not be able to understand.