I'm reading Hartshorne's Algebraic Geometry, section I.$5$, where he defines singularity as this: $P\in X$ is said nonsingular if $\mathcal{O}_{P, X}$ is a regular local ring. (for $X$ any quasi-projective variety)
I've noticed that he implicitly assumes that if $P\in X$ is nonsingular and $U\subset X$ is an open subset containing $P$, then $P\in U$ is nonsingular.
I only know that $\mathcal{O}_{P, X}\subset \mathcal{O}_{P, U}$ and I can't justify $\mathcal{O}_{P, X}$ regular $\Rightarrow \mathcal{O}_{P, U}$ regular.
Stalks at a point are a local construction, i.e. there is a canonical isomorphism $\mathscr{O}_{P,X} \simeq \mathscr{O}_{P,U}$. (For the map from left to right, for a section $f \in \mathscr{O}_X(V)$ with $P \in V \subseteq X$, map it to $f |_{U \cap V} \in \mathscr{O}_X(U \cap V)$ and from there to $\mathscr{O}_{P, U}$. For the map from left to right, for a section $f \in \mathscr{O}_X(V)$ with $P \in V \subseteq U$, then also $P \in V \subseteq U \subseteq X$ so $f$ is also directly in the direct limit defining $\mathscr{O}_{P, X}$. Now, just check the well-definedness and compositions of these maps.)
Alternatively, to factor this argument into slightly higher-level concepts: