> Is there a general approach to do this for more complex expressions? Yes, there is a way. Note that a regular language is the language accepted by a *NFA/DFA* so the general approach to problems of this kind is to convert your expression into its corresponding *NFA/DFA* and then lexicographically search through all the words of the language until you find the first one that is accepted by your machine (reach the final state). I am not aware of other general methods besides this one.