$ ./guess_the_languageRegex
Regex · medium · #60

What does this expression return?

'2024-06-15'.match(/^(\d{4})-(\d{2})-(\d{2})$/).slice(1)
  1. ['2024', '06', '15']
  2. ['2024-06-15']
  3. ['06', '15']
  4. ['2024-06-15', '2024']
Element 0 is the full match, so slice(1) keeps just the three captured date parts.
Play Regex ▸