Dielectric barrier discharges (DBDs) are investigated in helium and nitrogen as a function of pressure from 5 to 1000 mbar. Different regimes are observed: glow, Townsend, multi-peak and filamentary, depending on pressure, power and electrode gap. In helium, DBD is a glow-like discharge with a transition to multi-peak or Townsend discharge at high power. In nitrogen, the discharge is Townsend-like and shows a transition to multi-peak mode below 300 mbar. Transition to filamentary mode is observed for large gaps. Fast exposure imaging is used to investigate multi-peak mode in nitrogen. Electrical measurements and time-resolved optical emission spectroscopy are used to characterize the discharge, to study the evolution of metastable species as a function of the pressure and to analyse the discharge startup. These results offer new perspectives for the operation of DBDs in low vacuum.