$ ./guess_the_languageRegex
Regex · medium · #14

What does this expression return?

'2024-01-15'.match(/[^-]+/g)
  1. ['2024', '01', '15']
  2. ['2024', '-01', '-15']
  3. ['2024-01-15']
  4. ['2', '0', '1']
A leading ^ inside brackets negates the class, so [^-]+ matches runs of non-hyphen characters.
Play Regex ▸