general_path_sorter
- general_path_sorter(path_list, pattern)[source]
General sorting of paths in ascending order with regex pattern.
The regex pattern must contain a “group1” which matches any number. The paths are then sorted with this number in ascending order.
- Parameters
- path_list: list
List of filenames or paths
- pattern: str
regex pattern that matches any number. The group must be marked as “group1”. E.g. “(?P<group1>[0-9]+)cycles” would match the number 1234 in “1234cycles”.
- Returns
- paths: array
Sorted paths in ascending order
- numbers: array
The numbers from the match corresponding to the paths.