Well, once again, I recommend getting started by drawing the finite state machine. So on a or on b, we go over to state 2, and we could end there because this is optional, or on c or d, we could go to state 3 and end there. Here at the top, I've encoded the edges from state 1 on a we go to state 2. From state 1 on b, we go to state 2 as well--a or b. From state 2 on c, we go to state 3. From state 2 on d, we go to state 3. And both states, 2 and 3, are accepting. Then down here, I have 3 test cases. "ac" which should be accepted. "aX" which should not. X has no business in this regular expression. And just "b" alone, which should be fine because the c - d part is optional. Let's go see. And we get exactly the output we were expecting--true, false, true. Now you might have been tempted to have a c - d self-loop back to 2, instead of this right-hand side of the finite state machine. However, this self-loop changes the meaning to "[a - b][c - d]*". If you have this self-loop, acc is accepted--a-c-c, and it shouldn't be, so the self-loop is not the right way to go.