The controlled rebuilding of localized intense electromagnetic pulses is described by means of exact solutions of the nonlinear Schrödinger equation. These solutions illustrate the essential dependence of dynamics of such pulses in a dispersive medium upon the details of the initial shape of the pulse; therefore the role of the periphery regions of the pulse may be very important. The threshold values of intensity, divided by the regions of subcritical and supercritical evolution regimes, are calculated for the different pulses. The gradual formation of the spikelike pulses and the electromagnetic shock waves in the supercritical regime and the limited time of such formation are analyzed.