Consider this: $$\langle \mathbf{r} | \hat{\mathbf{P}} | \psi \rangle = \displaystyle\int d^3\mathbf{r}'\displaystyle\int d^3\mathbf{r}''\langle \mathbf{r}|\mathbf{r'}\rangle\langle\mathbf{r}'|\hat{\mathbf{P}}|\mathbf{r}''\rangle\langle\mathbf{r''}|\psi\rangle = \\ = \displaystyle\int d^3\mathbf{r}'\displaystyle\int d^3\mathbf{r}''\langle \mathbf{r}|\mathbf{r'}\rangle\Big(-i\hbar\nabla_{\mathbf{r}'}\delta^3(\mathbf{r'}-\mathbf{r''})\Big)\psi(\mathbf{r''}) $$ Where $\hat{\mathbf{P}}$ is the momentum operator in three dimensions and $\langle\mathbf{r}|$ is the position bra.
Can I move the gradient to the outer integral? I appreciate any tips on this.