From: Nikolai Weibull Date: 2005-06-11T09:21:52+09:00 Subject: Re: Regex help Ezra Zygmuntowicz wrote: > Say that I have a string like this: > > "SPT_051205.jpg" > > How could I strip out the numbers that stand for the date and convert > it to look like this: > > "May 12 2005" > "SPT_051205.jpg".scan(/(\d\d)(\d\d)(\d\d)/) do |a| puts Time.mktime(a[2].to_i + 2000, a[0].to_i, a[1].to_i).strftime("%b %d %Y") end Enjoy, nikolai -- Nikolai Weibull: now available free of charge at http://bitwi.se/! Born in Chicago, IL USA; currently residing in Gothenburg, Sweden. main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}