E4209

E4209#

Compiler diagnostic name: duplicate_regex_match_binding.

Duplicate regex match binding.

Each special binding in a regex match expression can be specified at most once. Using before or after multiple times would give the same part of the match more than one name.

Erroneous example#

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

Suggestion#

Use each binding label only once.

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