Convert the regular expression to a finite automaton accepting $L$. Then interchange accepting and non-accepting states, which produces an automaton accepting $\Sigma^*\setminus L$. Finally, convert the automaton to a regular expression.
This is not correct - for example, you do not allow any strings starting with bba, while there are many valid ones (eg bba itself).
One possible way of achieving this is to construct a DFA, then convert that to a regular expression, but that is quite a complicated process. In this case, there is a simpler method just by considering the options.
If the word doesn't have two consecutive bs, then it is obviously valid. This means all bs, except possibly the first, are preceded by an a. There are a few ways to write this, eg:
b(a+ab)* + (a+ab)*
If the word does have consecutive bs, then it cannot have an a both before and after. In other words, there can only be one 'long' string of bs, and it must come at the very start or the very end. So it is either:
b*
- a string of bs, followed by a, followed by anything with no consecutive bs
b*a(b(a+ab)* + (a+ab)*)
(b(a+ab)* + (a+ab)*)ab*
So one complete answer is:
b(a+ab)* + (a+ab)* + b* + b*a(b(a+ab)* + (a+ab)*) + (b(a+ab)* + (a+ab)*)ab*
There of course may be nicer and shorter answers!
Best Answer
It will be the union of two languages: $$ A = \mbox{All words that have 00 but not 11} $$ and $$ B = \mbox{All words that have 11 but not 00} $$ A regular expression for a language that does not contain
11
can be of the form: $$(1+\epsilon)(01+0)*$$ Therefore, a regular expression for A could be: $$ (1+\epsilon)(01+0)* (00) (1+\epsilon)(01+0)* $$ And a regular expression for B could be similar.