My question is about Lemma 15.44.2 from the Stacks Project:
Lemma 15.44.2 Let $R$ be a Noetherian ring. Let $X = \text{Spec}(R)$. The ring $R$ is J-1 (i.e. $\text{Reg}(X)$ is open) if and only if $V(\mathfrak p) \cap \text{Reg}(X)$ contains a nonempty open subset of $V(\mathfrak p)$ for all $\mathfrak p \in \text{Reg}(X)$.
The proof refers to the following lemma from topology:
Lemma 5.16.5 Let $X$ be a Noetherian topological space. Let $E \subset X$ be a subset. The following are equivalent:
(1) $E$ is open in $X$, and
(2) for every irreducible closed subset $Y$ of $X$ the intersection $E \cap Y$ is either empty or contains a nonempty open of $Y$.
I am aware that $X = \text{Spec}(R)$ is a Noetherian topological space as $R$ is a Noetherian ring and that the sets $V(\mathfrak p)$, $\mathfrak p \in \text{Spec}(R)$, are precisely the irreducible closed subsets of $X$. Further, $V(\mathfrak p) \cap \text{Reg}(X) \neq \emptyset$ if $\mathfrak p \in \text{Reg}(X)$, as clearly $\mathfrak p \in V(\mathfrak p)$.
My question: Why does it suffice in Lemma 15.44.2 to consider only prime ideals $\mathfrak p \in \text{Reg}(X)$ (and not $\mathfrak p \in \text{Spec}(X)$)? Or in other words, what happens to $V(\mathfrak p) \cap \text{Reg}(X)$ if $\mathfrak p \not\in \text{Reg}(X)$?
I am grateful for any help.
The key fact you need to use is that a localization of a regular local ring is regular, so $\operatorname{Reg}(X)$ is stable under generalization. This means that if $\operatorname{Reg}(X)\cap V(\mathfrak{p})$ is nonempty, then $\mathfrak{p}\in\operatorname{Reg}(X)$. So if $\mathfrak{p}\not\in \operatorname{Reg}(X)$, then $\operatorname{Reg}(X)\cap V(\mathfrak{p})$ is empty and condition (2) of Lemma 5.16.5 is still satisfied.