How to write regular expression excluding certain pattern aba from albhabet set {a,b}?
Maybe the easiest (though not necessarily fastest, if done by hand) way to do this is to make use of the many equivalent formalisms for regular languages:


Create an NFA that accepts all words that contain the pattern. (This NFA will consist of a chain of transitions that are labeled with the pattern and additionally can loop in the initial or final state on every symbol.)
Transform that NFA into a (complete) DFA using a standard algorithm.
Make all the accepting states of the DFA non-accepting and vice versa.
Translate the inverted DFA into a RE using a standard algorithm.