Names that follow ([a-z]+)([0-9]+) pattern are incredibly common in system administration. We have interfaces names eth10 or tun99, hosts names 0.pool.ntp.org and similar.
Standard lexicographic sorting gives counter-intuitive and unsatisfactory results for such strings: eth10 is considered less than eth9, the result is a total mess.
We need to implement a compare function that takes this into account such that:
- eth10 > eth9
- eth1.100 > eth1.99
- www0.example.com > www1.example.com