The problem comes from Eisenbud's "Commutative Algebra with a view toward Algebraic Geometry", 18.13. He uses the following fact:
Let $R$ be a Cohen-Macaulay ring. If $I = (x_1, \dots, x_n)$ such that $\operatorname{codim} I = n$. Then $x_1, \dots, x_n$ is a regular sequence.
How to prove this fact? I know that $\operatorname{depth} I = \operatorname{codim} I = n$. But I do not see why $x_1, \dots, x_n$ is a regular sequence.
A Counterexample. I found a counterexample. Let $k$ be a field, then $R = k[x,y,z]$ is a Cohen-Macaulay ring. For the ideal $I = (x, y(1-x), z(1-x))$, $\operatorname{codim} I = 3$. $x, y(1-x), z(1-x)$ is regular, but $y(1-x), z(1-x), x$ is not. Note that $x(z-z^2) = 0$ in $R/(y(1-x), z(1-x))$.