def parse_weekly_dates(value)
      # FIXME repeats data from monthweek. we should probably get a more
      # robust parser going here
      unless md = /^\s*(?:Every )?\s*(1st|2nd|3rd|4th|last|first|second|third|fourth)?(?:\s*(?:and|&)\s*(1st|2nd|3rd|4th|last|first|second|third|fourth))?\s*((?:Sun|Mon|Tues|Wednes|Thurs|Fri|Satur)day)s?\s*(?:of each month|of the month|every month)?\s*$/i.match(value)
        return nil
      end
      weekday = Date::DAYNAMES.index(md[3].downcase.capitalize)
      if md[2]
        monthweek = [monthweek(md[1]), monthweek(md[2])]
        return [{:weekday => weekday, :monthweek => md[1]}, {:weekday => weekday, :monthweek => md[2]}]
      elsif md[1]
        monthweek = monthweek(md[1])
      else
        monthweek = nil
      end
      {:weekday => weekday, :monthweek => monthweek }
    end
def parse_weekly_dates(value)
      # FIXME repeats data from monthweek. we should probably get a more
      # robust parser going here
      unless md = /^\s*(?:Every )?\s*(1st|2nd|3rd|4th|last|first|second|third|fourth)?(?:\s*(?:and|&)\s*(1st|2nd|3rd|4th|last|first|second|third|fourth))?\s*((?:Sun|Mon|Tues|Wednes|Thurs|Fri|Satur)day)s?\s*(?:of each month|of the month|every month)?\s*$/i.match(value)
        return nil
      end
      weekday = Date::DAYNAMES.index(md[3].downcase.capitalize)
      if md[2]
        monthweek = [monthweek(md[1]), monthweek(md[2])]
        return [{:weekday => weekday, :monthweek => md[1]}, {:weekday => weekday, :monthweek => md[2]}]
      elsif md[1]
        monthweek = monthweek(md[1])
      else
        monthweek = nil
      end
      {:weekday => weekday, :monthweek => monthweek }
    end
Parses the given value for repeating date strings of the form:

 * Saturdays
 * Every Friday
 * every 3rd tuesday
 * 2nd and 4th Fridays of the month

 and returns a hash with keys :weekday and :monthweek, where the weekday
 is the index of the day in the Date::DAYNAMES array (0-based) and the
 monthweek is either nil, an integer, or an array of integers,
 corresponding to the offset of the week(s) of the month.