dates = ["17Mar2009", "11/27/2009", "18/03/09", "Mar182009", "2009Mar22", "17-12-2008"]
def date_scanner(dates)
  dates.each do |date|
    date.scan(/^([0-3]\d)(\D{3,})(\d{2,4})|^([0-3]\d)\W([0-3]\d)\W(\d{2,4})|^(\D{3,})([0-3]\d)(\d{2,4})|^(\d{4})(\D{3,})([0-3]\d)/) do |match1,match2,match3,match4,match5,match6,match7,match8,match9,match10,match11,match12|
      p match3 + match2 + match1
      p match6 + match4 + match5
      p match9 + match8 + match7
      p match10 + match11 + match12
    end
  end
end

date_scanner(dates)

Add a code snippet to your website: www.paste.org