Parsing date from text using Ruby
I'm trying to figure out how to extract dates from unstructured text using Ruby. For example, I'd like to parse the date out of this string "Applications started after 12:00 A.M. Midnight (EST) February 1, 2010 will not be considered." Any suggestions? Assuming you just want dates and not datetimes: require 'date' string = "Applications started after 12:00 A.M. Midnight (EST) February 1, 2010 will not be considered." r = /(January|February|March|April|May|June|July|August|September|October|November|December) (\d+{1,2}), (\d{4})/ if string[r] date =Date.parse(string[r]) puts date end Try