<matchAll>

The matchAll flag allows you to look for multiple occurrences of a match, instead of just one.

Usage

<matchAll>

Example

const wordToMatch = "I am 25 years old";
const codeWithoutFlag = "[number]";
const codeWithFlag = "<matchAll> [number]";

regCode.match(codeWithoutFlag, wordToMatch);    // 2
regCode.match(codeWithFlag, wordToMatch);       // 25

Regex

//g