Skip to main content
2 of 8
added a note about the length of each element
Arnauld
  • 197.6k
  • 20
  • 179
  • 650

##JavaScript (ES6), 105 bytes

Assumes that each element is up to 99 characters long. This limit could be increased to any arbitrary value (like 1e3) at the cost of 2 additional bytes.

a=>a.map(s=>[s.replace(/\d+|\D+/g,s=>('0'.repeat(99)+s.toLowerCase()).slice(-99)),s]).sort().map(a=>a[1])

###Test

let f =

a=>a.map(s=>[s.replace(/\d+|\D+/g,s=>('0'.repeat(99)+s.toLowerCase()).slice(-99)),s]).sort().map(a=>a[1])

console.log(f([
  'Cat05.jpg',
  'Meme00.jpeg',
  'cat1.jpeg',
  'cat02.jpg',
  'meme03-1.jpeg',
  'meme03-02.jpg',
  'meme04.jpg'
]).join('\n'))

Arnauld
  • 197.6k
  • 20
  • 179
  • 650