# E0077

Warning name: `lexmatch_longest_match`

Using `lexmatch` with longest-match semantics.

This warning is disabled by default. It can be enabled to audit remaining
`lexmatch ... with longest` usages. Regex match expressions do not provide
longest-match semantics, so code that relies on lexer-style longest matching
may need to keep `lexmatch ... with longest`.

## Erroneous example

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

## Suggestion

If longest-match behavior is not required, rewrite the code without `lexmatch`.
For example, use a regex match expression for a full-string regex check.

If longest-match behavior is required, keep `lexmatch ... with longest` and
leave this audit warning disabled or suppress it locally.

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