This device looks like a Transistor, but it is actually a complex Integrated Circuit. The circuit diagram below represents a typical use of a voltage regulator. The LM7805 can reliably deliver 1 amp at a constant voltage. The 2500uF capacitor helps to maintain a constant input into the regulator. The 0.1uF capacitor eliminates any high frequency pulses that could otherwise interfere with the operation of the regulator.
Voltage regulators are very robust.
In both cases the regulator will shut down before damage occurs. The only way to destroy a regulator is to apply reverse voltage to its input. Reverse polarity destroys the regulator almost instantly. To avoid this possibility you should always use diode protection of the power supply. Even this short 'test' would destroy the regulator if a protection diode were not used.