Proof. Recall that a regular local ring is a domain, see Algebra, Lemma 10.105.2. We will prove the unique factorization property by induction on the dimension of the regular local ring $R$. If $\dim (R) = 0$, then $R$ is a field and in particular a UFD. Assume $\dim (R) > 0$. Let $x \in \mathfrak m$, $x \not\in \mathfrak m^2$. Then $R/(x)$ is regular by Algebra, Lemma 10.105.3, hence a domain by Algebra, Lemma 10.105.2, hence $x$ is a prime element. Let $\mathfrak p \subset R$ be a height $1$ prime. We have to show that $\mathfrak p$ is principal, see Algebra, Lemma 10.119.6. We may assume $x \not\in \mathfrak p$, since if $x \in \mathfrak p$, then $\mathfrak p = (x)$ and we are done. For every nonmaximal prime $\mathfrak q \subset R$ the local ring $R_\mathfrak q$ is a regular local ring, see Algebra, Lemma 10.109.6. By induction we see that $\mathfrak pR_\mathfrak q$ is principal. In particular, the $R_ x$-module $\mathfrak p_ x = \mathfrak pR_ x \subset R_ x$ is a finitely presented $R_ x$-module whose localization at any prime is free of rank $1$. By Algebra, Lemma 10.77.2 we see that $\mathfrak p_ x$ is an invertible $R_ x$-module. By Lemma 15.102.6 we see that $\mathfrak p_ x = (y)$ for some $y \in R_ x$. We can write $y = x^ e f$ for some $f \in \mathfrak p$ and $e \in \mathbf{Z}$. Factor $f = a_1 \ldots a_ r$ into irreducible elements of $R$ (Algebra, Lemma 10.119.3). Since $\mathfrak p$ is prime, we see that $a_ i \in \mathfrak p$ for some $i$. Since $\mathfrak p_ x = (y)$ is prime and $a_ i | y$ in $R_ x$, it follows that $\mathfrak p_ x$ is generated by $a_ i$ in $R_ x$, i.e., the image of $a_ i$ in $R_ x$ is prime. As $x$ is a prime element, we find that $a_ i$ is prime in $R$ by Algebra, Lemma 10.119.7. Since $(a_ i) \subset \mathfrak p$ and $\mathfrak p$ has height $1$ we conclude that $(a_ i) = \mathfrak p$ as desired. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).