\(M=\left(\dfrac{1}{\sqrt{x}-1}+\dfrac{x-\sqrt{x}+1}{x+\sqrt{x}-2}\right)\div\left(\dfrac{\sqrt{x}+1}{\sqrt{x}+2}-\dfrac{x-\sqrt{x}-4}{x+\sqrt{x}-2}\right)\)
\(=\left[\dfrac{1}{\sqrt{x}-1}+\dfrac{x-\sqrt{x}+1}{\left(\sqrt{x}-1\right)\left(\sqrt{x}+2\right)}\right]\div\left[\dfrac{\sqrt{x}+1}{\sqrt{x}+2}-\dfrac{x-\sqrt{x}-4}{\left(\sqrt{x}-1\right)\left(\sqrt{x}+2\right)}\right]\)
\(=\dfrac{\left(\sqrt{x}+2\right)+\left(x-\sqrt{x}+1\right)}{\left(\sqrt{x}-1\right)\left(\sqrt{x}+2\right)}\div\dfrac{\left(\sqrt{x}+1\right)\left(\sqrt{x}-1\right)-\left(x-\sqrt{x}-4\right)}{\left(\sqrt{x}-1\right)\left(\sqrt{x}+2\right)}\)
\(=\dfrac{x+3}{\left(\sqrt{x}-1\right)\left(\sqrt{x}+2\right)}\times\dfrac{\left(\sqrt{x}-1\right)\left(\sqrt{x}+2\right)}{\sqrt{x}+3}\)
\(=\dfrac{x+3}{\sqrt{x}+3}\)