A couple homework problems that I've been working on, hoping I can get it done right. Can anyone confirm if my line of reasoning and regex is correct?
L = { $w \in $ {$x, y$}* | $w$ contains a maximum one instance of $xx$ }
My answer $$ ((y^*+x)^2)y^*$$
This ticks off $y, x, xx, yx, xy, yyy$, but won't allow more than one $xx$. Only issue I could find is that it doesn't allow $yxyxy$ and the like. Any tips on how to overcome this on a larger scale? Don't know if $$ (((y^*+x)^2)y^*)^*$$ is cheating, also considering that you can have $xxxx$ from that Thoughts?
L = { $w \in $ {$0, 1$}* | $w$ does not have any instances of $011$ }
My answer
$$(0^*1)^* + 1^*0^*$$
This allows $0, 01, 1, 10, 001$, etc. The only issue I seem to find is that it does not allow $00101$. Almost the same issue as last one, any ideas on how to overcome these?