$ ./guess_the_languageRegex
Regex · hard · #38

What does the final expression return?

const re = /\d/y;
re.lastIndex = 0;
[re.test('a1'), re.test('1a')]
  1. [false, true]
  2. [true, true]
  3. [true, false]
  4. [false, false]
A sticky (y) regex must match exactly at lastIndex; "a1" fails at 0 (resetting it to 0), "1a" succeeds.
Play Regex ▸