I am trying to solve a regular expression of binary string where every even position is a '1'

I've solved this for an odd position: (1(0+1))*(1+ε)

How would it look like for an even position then? Thanks in advance.

  • 1
    $\begingroup$ You successfully solved the odd position case. What makes the even position case conceptually more difficult? $\endgroup$ – Hendrik Jan Apr 21 '19 at 12:05
  • $\begingroup$ I was a bit confused though. $\endgroup$ – Shunjid Rahman Apr 22 '19 at 7:51

An odd position can either have 0 or 1 and every even position can only have 1. RE for this can be: $$ ((0 + 1)1)^* (\epsilon + (0+1))$$ Note that, it also contains the empty word.

  • 2
    $\begingroup$ you are missing words of odd length $\endgroup$ – Ran G. Apr 21 '19 at 10:05
  • $\begingroup$ added the edit, thanks for pointing it out. $\endgroup$ – SiluPanda Apr 21 '19 at 10:46
  • 1
    $\begingroup$ @SiluPanda Thanks :-) $\endgroup$ – Shunjid Rahman Apr 22 '19 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.