From: Ezra Zygmuntowicz Date: 2005-06-11T09:34:24+09:00 Subject: Re: Regex help On Jun 10, 2005, at 5:21 PM, Nikolai Weibull wrote: > 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 > Thanks so much Nikolai it works perfect! -Ezra > -- > 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);} > -Ezra Zygmuntowicz Yakima Herald-Republic WebMaster 509-577-7732 ezra@yakima-herald.com