matchAll

For ES level < 2020:

  • maps str.matchAll(pattern).forEach {} to while (match = pattern.exec(str)) {}

Note pattern must be a simple variable with a value of a regular expression with the g flag set at runtime.

Next: minitest-jasmine