A Swift port of the FuzzyMatchV1 algorithm from fzf (v0.61.0).
import SwiftFzfAlgorithm
let (result, positions) = fuzzyMatchV1(
caseSensitive: false,
normalize: false,
text: "Hello World",
pattern: "hw",
withPos: true
)
print(result.score) // match score
print(result.start) // start index in text
print(result.end) // end index in text
print(positions ?? []) // matched character positionsMIT — see LICENSE. Original algorithm Copyright (c) 2013-2024 Junegunn Choi.