Given a list of n strings, return a list of that strings in ascending order. However, be aware, that in this case we want integer comparison for all numbers appearing in the strings, meaning that "12" > "3".
Example cases:
{"abc123", "abc6", "abc47", "abd49"} -> {"abc6", "abc47", "abc123", "abd49"}
{"foo0", "bar12", "foobar12", "foo"} -> { "bar12", "foo", "foo0", "foobar12"}
{"Bond007", "Bond07", "Bond7", "Bond12"} -> {"Bond007", "Bond07", "Bond7", "Bond12"}
{"one1", "one11two23", "one1two2", "one1two3", "1"} -> {"1", "one1", "one1two2", "one1two3", "one11two23"}
You can expect to only find [a-zA-Z0-9]+ in each string. This is code-golf so shortest code in bytes wins. Standard Loopholes are forbidden.
Update:
- Sorting is case insensitive
- The ascending order is integers < "abcdefghijklmnopqrstuvwxyz"
- Every sequence of integers as in the aforementioned order should be interpreted as one integer, meaning "421" represents 421, not 4, 2 and 1 and thus is smaller than "1341", as 421 < 1341
-Treat numbers with leadings zeroes as though they were decimals meaning "001" -> "0.01" so "001" < "01" < "1"
Thanks for Adám for pointing out, that this is called natural sort order.
01
vs.010
. \$\endgroup\$