E4183#
Compiler diagnostic name: regex_interpolation_is_not_supported.
This diagnostic described interpolation in an earlier lexical pattern form and is not emitted by the current compiler.
Current lexmatch and lexscan cases use regex constant expressions. Runtime
string interpolation is not a regex case pattern.
Erroneous example#
///|
pub fn match_text(text : String, part : String) -> Unit {
lexmatch text with longest {
("\{part}", _) => ()
_ => ()
}
}
The regex pattern tries to interpolate part.
Suggestion#
Use a literal or named regex constant. For dynamic matching, use the regular
Regex API.
///|
pub fn match_text(text : String) -> Unit {
lexmatch text with longest {
(re"^abc", after=_) => ()
_ => ()
}
}