$ ./guess_the_languageRegex
Regex · medium · #40

What does this expression return?

'a1\nb2'.match(/^\w/gm)
  1. ['a', 'b']
  2. ['a']
  3. ['a1', 'b2']
  4. null
With the m flag ^ matches at the start of every line, not just the start of the string.
Play Regex ▸