$ ./guess_the_languageRegex
Regex · medium · #20

What does this expression return?

'cat concat cats'.match(/\bcat\b/g)
  1. ['cat']
  2. ['cat', 'cat']
  3. ['cat', 'cat', 'cat']
  4. null
\b needs a word/non-word transition on both sides, so only the standalone word "cat" qualifies.
Play Regex ▸