With the Euclidean metric, a subset $Y \subseteq \R$ is connected iff $Y$ is an interval, i.e. if $x,y\in Y$ and $x<z<y$, then $z\in Y$.
Proof