E0080#
Warning name: regex_match_missing_before
lexmatch パターンは入力の接頭部分を読み飛ばせますが、そのパターンは接頭部分を束縛も明示的な無視もしていません。
固定されていない正規表現は、入力の先頭から前方へ検索します。マッチを先頭から開始する必要がある場合は ^ を追加し、そうでなければ before= で読み飛ばした接頭部分を束縛または無視してください。
Erroneous example#
///|
pub fn ends_with_digits(input : String) -> Bool {
lexmatch input {
re"[0-9]+$" => true
_ => false
}
}
Suggestion#
Anchor the regex at the start, or make the skipped prefix explicit with
before=prefix or before=_.
///|
pub fn ends_with_digits(input : String) -> Bool {
lexmatch input {
(re"[0-9]+$", before=_) => true
_ => false
}
}