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?
CC BY-SA 4.0
2021-01-20T12:48:41.253
83772
2021-02-23T03:24:08.397
2021-02-23T03:24:08.397
37097
36278
question
grammar word-choice nuances synonyms
replacing よう with みたい
Despite their meanings being similar, there is distinction that lies in their
usage. みたい is used in speech in which has a casual tone while よう is used less
often like in writing (like letters).

I have included some videos for reference:

<https://www.youtube.com/watch?v=An6sKwhUH48>

<https://www.youtube.com/watch?v=7uHIaZD23-U>
CC BY-SA 4.0
2021-01-21T02:54:10.657
83785
2021-01-21T02:54:10.657
25407
83772
answer