2007/7/10, Todd Benson <caduceass / gmail.com>: > On 7/9/07, 12 34 <rubyforum / web.knobby.ws> wrote: > > seqNo = > > File.basename("/Volumes/MINOLTA1/DCIM/100MLT16/PICT0004.MOV",".*")[-1,3].to_s > > seqNo = "-" + seqNo+ ".xx.m" > > puts "seqNo: #{seqNo} " # >> seqNo: -4.xx.m > > > > but I want it to be -004.xx.m. In other words I want the leading zeros. > > Maybe you want [-3,3] instead of [-1,3]? Or seqNo = File.basename(fname)[/\d+/] cheers robert