Let $u\in L^\infty(\Omega)\cap H^1(\Omega)$ with $\Omega$ open, bounded and regular (as you wish) domain of $\mathbb{R}^N$. Is it true that
$$ \int_\Omega |\nabla u(x)|^2 \mathrm{d} x= \int_{\mathbb{R}^N}| \nabla (u(x) \chi_\Omega(x))|^2 \mathrm{d} x $$
where $u \chi_\Omega$ is the extension of $u$ by zero outside $\Omega$?