E4172#
Compiler diagnostic name: invalid_regex_pattern.
Invalid regex pattern.
re"..." リテラルが MoonBit の正規表現構文に従っていない場合に、このエラーが発生します。正規表現リテラルはコンパイル時に検査されるため、構文エラー、未対応のアサーション、不正な範囲、重複するキャプチャ名はプログラムの実行前に報告されます。
Erroneous example#
fn invalid_regex() -> Regex {
re"[a-z"
}
The character class starts with [, but never closes with ].
Suggestion#
Fix the regex syntax, or rewrite the pattern using a supported regex form.
fn valid_regex() -> Regex {
re"[a-z]"
}