Using regex to add leading zeroes September 12, 2023 by Tarik In Perl: s/([0-9]+)/sprintf('%04d',$1)/ge;