The propagation of a laser beam of intensity $I$ in a nonlinear medium with a refractive index $n(I)$ of arbitrary form is studied. In particular, the influence of the functional form $n=n(I)$ on self-focusing and self-trapping is investigated. Starting from the propagation equations and using symmetry considerations and the Bogoliubov renormalization group approach, we derive a general equation relating the self-focusing distance, the intensity, and $n(I)$. For different polynomial dependences of $n(I)$ on $I$, we construct analytical solutions for the spatial intensity profile $I(\mathbf{r})$ for an initially collimated Gaussian beam inside the medium. We also explicitly analyze the case of nonlinear self-focusing accompanied by multiphoton ionization. For particular (already studied) cases, we considerably improve the accuracy of the results with respect to previous semianalytical studies and obtain very good agreement with recent numerical simulations.