We study the regularity of minimizers and critical points of the Dirichlet energy under an integral constraint given by a non-differentiable function. We obtain existence of a Lipschitz continuous minimizer for a relaxed problem. In two dimensions, some regularity can also be proved for critical points.