I need help in this regural expression exercises Write a regular expression for the language of words over $\{0,1,2\}$ satisfying the following requirements:
  
  
  The word has length at least 3.
  The last symbol is 2.
  The second to last symbol isn't 0.
  The combination of the last two symbols doesn’t appear anywhere else in the string.
In order to solve this exercise, we need to come up for regular expressions for two classes of words:


Words of the form $x00$, where $x \neq \epsilon$ and the only occurrence of $00$ is at the end.
Words of the form $x01$, where $x \neq \epsilon$ and the only occurrence of $01$ is at the end.


Let us start with the first class. For starters, $x$ must end with $1$ or $2$. So such words are of one of the forms $y100$ or $y200$, where $y$ doesn't contain $00$. Presumably you already know how to describe all words not containing $00$ using a regular expression.

For the second class, the only constraints on $x$ are that it is non-empty and doesn't contain $01$. If you don't like the "non-empty" constraint, you can use the following case distinction:


If $x = y0$ or $x = y2$, then the only constraint on $y$ is that it doesn't contain $01$.
If $x = y1$, then $y$ cannot end with $0$. It could be empty. If it ends with $2$, then $x$ is of the form $z21$. If it ends with $1$, then we're again in the same situation: the preceding symbol (if any) cannot be $0$. Continuing in this way, we see that either $x \in 1^+$ or $x$ is of the form $y2z$, where $y$ doesn't contain $01$ and $z = 1^n$ for some $n \geq 1$.


I'll let you figure out how to describe strings $y$ avoiding $01$ – this is very similar to the case of avoiding $00$.