Skip to main content

best_match

Function best_match 

Source
pub fn best_match(needle: &str, haystack: &str) -> Option<Match>
Expand description

Best fuzzy match of needle in haystack, or None if it does not match at all.

Every starting position is tried and the highest-scoring alignment wins. This is what makes revdetail land on revenue_detail rather than on the re in warehouse, and it is the behaviour people arrive with.

Matching is case-insensitive. An empty needle matches everything with score 0.