# E4232

Compiler diagnostic name: `regex_constant_in_pattern`.

A regex constant cannot be used as an ordinary pattern. Matching a constant
in a regular `match` is not the same as applying a regex to text or bytes.

## Erroneous example

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

## Suggestion

For text matching, use the regex with `=~`, `lexmatch`, or `lexscan`.
Do not use an ordinary constant pattern to compare regex values.

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

For a byte regex constant, use its `execute` method to match bytes.
