E4208

E4208#

编译器诊断名称:unknown_regex_match_binding

未知的正则匹配绑定。

正则匹配表达式除匹配的正则本身外,只支持特殊绑定 beforeafterbefore 绑定未匹配的前缀,after 绑定未匹配的后缀。

错误示例#

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

middle 不是受支持的正则匹配绑定标签。

建议#

使用 beforeafter,或者用 as 绑定正则本身。

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