I have noticed that since strings are compared using alphabetical order, if they start with a number they won't be compared correctly. For example, '10' will be placed before '2' in the sorted results. So, I tried to fix this problem using a regular expression that extracts the numeric portion at the beginning of each string (if it's possible) and performs a numerical comparison.
See an example below.
I have noticed that since strings are compared using alphabetical order, if they start with a number they won't be compared correctly. For example, '10' will be placed before '2' in the sorted results. So, I tried to fix this problem using a regular expression that extracts the numeric portion at the beginning of each string (if it's possible) and performs a numerical comparison. See an example below.