Is it always possible to replace よう with みたい?
For example in this sentence:
思うようにはいかないものだ。
Would
思うみたいにはいかないものだ 。
work as well?
I've read many times that these two can be interchangeable, but it seems that's not always the case. Are there are any rules explaining when one of them sounds better or is grammatically correct and the other doesn't or is not?