E4208

E4208#

Compiler diagnostic name: unknown_regex_match_binding.

Unknown regex match binding.

Regex match expressions support only the special bindings before and after beside the matched regex itself. before binds the unmatched prefix and after binds the unmatched suffix.

Erroneous example#

fn match_text(s : String) -> Unit {
  ignore(s =~ (re"a", middle=mid))
}

middle is not a supported regex match binding label.

Suggestion#

Use before or after, or bind the regex itself with as.

fn match_text(s : String) -> Unit {
  ignore(s =~ (re"a", before=head))
}