Enhance Natural Sorting to work with UUIDs
Posted: 03.05.2020, 03:53
I find Natural Sorting to work best in almost all cases.
The exception is when files or folders have names that are (or contain) UUIDs.
Natural Sorting does not currently recognize UUIDs (or hexadecimal), so when there are 2 items, and one begins with '5F' and the other begins with '12', Natural Sorting will always list them in the wrong order.
If you want to quickly see some examples, you can view the hidden system folder 'c:\Windows\Installer'.
UUIDs are easy to identify with a regular expression:
That's all I need right now, but going one step further, and supporting hexadecimal everywhere, might be useful but a little tricky. Something along the lines of (combinations of 4 or more characters consisting of 0-9 and A-F) is easy enough and may not have disruptive false positives. We would need to think about any impact of false positives for that one. The regex UUID would not have false positives except in extremely bizarre or contrived cases.
The exception is when files or folders have names that are (or contain) UUIDs.
Natural Sorting does not currently recognize UUIDs (or hexadecimal), so when there are 2 items, and one begins with '5F' and the other begins with '12', Natural Sorting will always list them in the wrong order.
If you want to quickly see some examples, you can view the hidden system folder 'c:\Windows\Installer'.
UUIDs are easy to identify with a regular expression:
Code: Select all
/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/
Code: Select all
/[a-fA-F0-9]{4,}/