Global Flag Example

Use the global flag to find multiple matches.

Preview

Code

<script>
let text = "apple banana apple";

let result = text.match(/apple/g);

console.log(result);
</script>

More JS RegExp Examples (7)