O'Reilly logo
  • Benn Boulton thinks this is interesting:

var strToMatch = 'A Toyota! Race fast, safe car! A Toyota!'; var regExAt = /Toy/g; var arrMatches = regExAt.exec(strToMatch); console.log(arrMatches);

From

Cover of JavaScript : Moving to ES2015

Note

This code(with the g) does return all occurrences, only one and not oyo, it return ['Toy']