Skip to content

Latest commit

 

History

History
57 lines (44 loc) · 2.94 KB

File metadata and controls

57 lines (44 loc) · 2.94 KB

Hints

General

1. Match the day, month, and year from a date

  • Remember to return a string representing the regular expression pattern.
  • Review how to create character classes or use shorthand character classes.
  • Review quantifiers.
  • A day is one or two digits.
  • A month is one or two digits.
  • A year is four digits.
  • Create a regex pattern with re-pattern.
  • Return a regex match with re-matches.

2. Match the day of the week and the month of the year

  • Review how to write a pattern to match string literals.
  • Review alternations.
  • Wrap the whole expression in a group.

3. Capture the day, month, and year

  • Review how to write patterns for captures and named captures.
  • Reuse the day, month, year, day-names, and month-names functions that you already implemented.
  • You can use re-matcher to return an instance of java.util.regex.Matcher to use with re-find.

4. Combine the captures to capture the whole date

  • Remember, string concatenation may be used to join strings.
  • Reuse the capture-day, capture-month, capture-year, capture-day-name, and capture-month-name functions that you already implemented.

5. Narrow the capture to match only on the date

  • Remember, anchors help to match the pattern to the whole line.
  • String concatenation may be used in a call to re-pattern.
  • Reuse the capture-numeric-date, capture-month-name-date, and capture-day-month-nam-date functions that you already implemented.