wiki/content/20201116165324-matchall_expression.md

19 lines
332 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-29 18:27:12 +00:00
date: 2020-11-16
2024-05-06 20:40:05 +00:00
id: 32ffc92c-6a1d-4bf1-8f4c-b8d53ced6203
title: MatchAll Expression
---
# Description
Find all instances of a regular expression match, including the index.
# Syntax
``` javascript
const matches = "Here are some numbers: 5 12 88".matchAll(/\d+/g);
for (const match of matches) {
console.log(match);
}
```