  We obtain optimal regularity in the Sobolev space $W_0^{1,\tau}(\Omega)$ for
the unique solution of $$ -\Delta_m u=K(x)u^{-p} \mbox{in} \Omega, \quad
u=0\mbox{on}\partial \Omega. $$ Here $\Omega\subset{\mathbb R}^N$ is a smooth
and bounded domain, $m>1$, $p\geq 0$ and $K\in C(\Omega)$ is a positive
function that behaves like ${\rm dist}(x,\partial\Omega)^{-q}$ for some $q\geq
0$ with $p+q< 2-\frac{1-p}{m}$.
  We obtain that the unique weak solution to the above problem belongs to
$W_0^{1,\tau}(\Omega)$ for $$ m\leq \tau<\frac{m+p-1}{p+q-1}\quad
\mbox{if}p+q>1, $$ and $$ m\leq \tau<\infty\quad \mbox{if}p+q=1. $$ The above
range of $\tau$ is optimal.
