# E4180

Compiler diagnostic name: `unsupported_match_strategy`.

Unsupported `lexmatch` match strategy.

`lexmatch` only supports the default first-match strategy and the explicit
`longest` strategy. Other strategy names are rejected.

```{warning}
`lexmatch` is deprecated for new code. Prefer regex match expressions such as
`value =~ re"..."` unless you specifically need legacy lexer-style behavior.
```

## Erroneous example

The following example asks for an unsupported `shortest` strategy:

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

MoonBit will report an error.

## Suggestion

Use one of the supported strategies, or rewrite the code with a regex match
expression when first-match behavior is enough:

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