Existence and regularity of minimizers of nonconvex functionals depending on u and grad u