fn natural_sort_key(regex: &Regex, filename: &str) -> Vec<Result<i32, String>>Expand description
Extracts a natural sort key from a filename.
This function takes a filename as input and splits it into a list of parts using a regular expression. It then converts numeric parts to integers while keeping non-numeric parts as lowercase strings. This enables a natural sorting order that considers both alphabetical and numerical components of filenames, making it suitable for sorting filenames in a human-friendly manner.
§Arguments
regex- Pre-compiled regex object.filename- A string representing the filename.
§Returns
A vector of Result<i32, String> where each element is either an integer representing a numeric part
or a string representing a non-numeric part converted to lowercase.