E4209#
编译器诊断名称:duplicate_regex_match_binding。
重复的正则匹配绑定。
正则匹配表达式中的每个特殊绑定最多只能指定一次。多次使用 before 或 after 会给匹配的同一部分赋予多个名称。
错误示例#
fn match_text(s : String) -> Unit {
ignore(s =~ (re"a", before=head, before=prefix))
}
建议#
每个绑定标签只能使用一次。
fn match_text(s : String) -> Unit {
ignore(s =~ (re"a", before=head, after=tail))
}