---
url: /docs/guide/usage/linter/rules/oxc/bad-match-all-arg.md
---

### What it does

This rule warns when the `matchAll` method is called with a regular expression that does
not have the global flag (g).

### Why is this bad?

When called with a regular expression, the `matchAll` method requires the global flag (g).
Otherwise, it throws a `TypeError` at runtime instead of returning an iterator.

### Examples

Examples of **incorrect** code for this rule:

```javascript
text.matchAll(/pattern/);
```

Examples of **correct** code for this rule:

```javascript
text.matchAll(/pattern/g);
```

## How to use

## Version

This rule was added in v1.76.0.

## References
