$\def\codim{\operatorname{codim}} \def\sO{\mathscr{O}} \def\sI{\mathscr{I}} \def\sF{\mathscr{F}} \def\sG{\mathscr{G}}$In p. 306 of Görtz, Wedhorn, Algebraic Geometry I, 2nd ed., we find defined:
[Let $X$ be any scheme.] Assume that $Y$ is a closed subscheme of $X$ such that there exists an open affine covering $(U_i)$ of $X$ and regular elements $f_i\in\Gamma(U_i,\mathscr{O}_X)$ such that $Y \cap U_i = V (f_i)$ for all $i$ (such subschemes will be studied in more detail in Volume II where they will be called regularly immersed of codimension 1).
My first question is:
(Q1). Does $Y$ really have codimension 1 in $X$?
(For any closed subset $Z\subset X$, the codimension is defined $\codim_XZ=\underset{x\in Z}{\inf}\dim\sO_{X,x}$; one can show $\codim_XZ=\underset{F\subset Z}{\inf}\codim_XF$, where $F$ moves in the irreducible components of $Z$, cf. [ibid., sect. (5.8)].)
A few pages later, in the statement of Proposition 11.39, we find the implicit claim:
Let $X$ be a locally Noetherian scheme. Let $C\subset X$ be a closed integral subscheme of codimension 1, and denote $\sI$ to the ideal of sections on $X$ vanishing on $C$. Then $C$ is regularly immersed in $X$ if and only if, for all $x\in C$, $\sI_{x}=f\sO_{X,x}$, where $f\in\sO_{X,x}$ is a nonzerodivisor.
(I have translated the way they phrase it in the book.) It is clear that the condition is necessary. My second question is:
(Q2). Why is it sufficient?
I think they hint it in the proof of Theorem 11.40 (2): there they invoke the result “if $X$ is any ringed space, $\sF,\sG$ are $\sO_X$-modules of finite presentation, and $x\in X$, then any isomorphism $\sF_x\to\sG_x$ extends to an isomorphism $\sF|_U\to\sG|_U$, for some open $U\subset X$” (Proposition 7.27 (2)) to infer the existence of an open $U\subset X$ such that $\sI|_U=f\sO_{U}$, where $f\in\sO_X(U)$ is a regular section. My question is: how can we do this? First, we would need to show that $\sI$ is of finite presentation (it suffices to see it is $\sO_X$-coherent; in turn, it suffices to see it is of $\sO_X$-finite), but why so? Second, the invoked result only gives an isomorphism $\sI_U\cong f\sO_U$, but how one can obtain an equality from this?