I'm working through some exam questions for a module in college. I've been asked to create a regular expression that recognises all words that have an even number of ’1’s and starts and ends with a ’0’ when given a binary alphabet {0, 1}. However, the solutions are not available online and I want to verify that my solution is correct as I then must convert create an NFA -> DFA using Subset Closure from this regular expresion.
I'm wondering if the following is correct?
0*, (1, 0*, 1)*, 0*
Actually I think you solution has some flaws.
0
(should be +
instead of *
0110110
, since the 0
in the middle can not be matched (include possibility to match only 0
)^
and $
)My suggestion is to use the following RegEx: ^0+((10*1)|0*)*0+$