# E0058

Warning name: `unused_non_capturing`

Unnecessary non-capturing group in regex.

This warning is emitted when a regex contains a non-capturing group that is not
needed. Consider simplifying the regex by removing the redundant group.

## Erroneous example

```{literalinclude} /sources/error_codes/0058_error/top.mbt
:language: moonbit
```

## Suggestion

Remove the redundant non-capturing group. If the matched part is needed, bind
that regex subexpression with `as`. Regex named capture groups are available
through `Regex::execute` and `MatchResult::named_group`, but they are not
binders in `=~` expressions:

```{literalinclude} /sources/error_codes/0058_fixed/top.mbt
:language: moonbit
```
