$ ./guess_the_languageRegex
Regex · hard · #57

What does this expression return?

'1234567'.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
  1. '1,234,567'
  2. '123,456,7'
  3. '1234,567'
  4. '1,2,3,4,5,6,7'
It inserts a comma at every inner position followed by a multiple of three digits up to the end.
Play Regex ▸