From: matt@... (matt neuburg) Date: 2007-07-11T22:19:48+09:00 Subject: Re: Simple string operation 12 34 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. seqNo = File.basename("/Volumes/MINOLTA1/DCIM/100MLT16/PICT0004.MOV",".*") seqNo = "-" + /\d*$/.match(seqNo)[0] + ".xx.m" puts "seqNo: #{seqNo} " But you might need to change that if you don't want all three leading zeros (your desired answer omits one). m. -- matt neuburg, phd = matt@tidbits.com, http://www.tidbits.com/matt/ Tiger - http://www.takecontrolbooks.com/tiger-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com