# Sorting %artist% treating numbers as text

**URL:** https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140
**Category:** Support
**Created:** [January 13, 2025, 6:20pm UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140 "2025-01-13T18:20:18Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![pgh](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/f6c823/32.png) [@pgh](https://community.mp3tag.de/u/pgh)
#### Post date: [January 13, 2025, 6:20pm UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/1 "2025-01-13T18:20:18Z")

</div>

On this site I found a great way to sort fields while ignoring first words like "A" "An" and "The" without having to add at the end preceeded by a comma (,):

`($regexp(%artist%,^The ,),^A ,),^An ,)`

Is it possible to treat numbers like text and sort alphabetically? (example: "1st" = "First") I believe the statement would call upon a list to convert. If so, I'd like to update the list as needed.

If this is possible, would someone please write the expression I can use. Thanks in advance! I recently discovered this great program and community.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 13, 2025, 6:38pm UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/2 "2025-01-13T18:38:28Z")

</div>

> [@pgh](#):
>
> ($regexp(%artist%,^The ,),^A ,),^An ,)

This should be:  
`$regexp(%artist%,^The|A|An ,)`

> [@pgh](#):
>
> Is it possible to treat numbers like text and sort alphabetically? (example: "1st" = "First")

Do you really want to get the numbers - which sort nicely ascending - to vanish somewhere in the alphabet, without the real sorting as  
"sixth" comes after "seventh" and "tenth" before "third".  
It would also be interesting how far you want to extend that translation: only 1-10 or further?

Or should it be the other way round that "first" gets replaced with "1.", "second" with "2."?  
Should this happen only for numbers at the beginning or anywhere in the string?

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [January 13, 2025, 6:50pm UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/3 "2025-01-13T18:50:51Z")

</div>

> [@ohrenkino](#):
>
> Do you really want to get the numbers - which sort nicely ascending - to vanish somewhere in the alphabet, without the real sorting as  
> "sixth" comes after "seventh" and "tenth" before "third".

And what to do with ARTIST names like  
777minus111  
123 Astronaut  
or number-only ARTIST names like  
123123  
1234!  
or with this example:  
8767456798324674397524572852252652 -\>[Jaiden Macintosh](https://musicbrainz.org/artist/ca36440c-3b39-426d-bc54-1bbe6a584e3d) and also performs as

 ![image](https://community.mp3tag.de/uploads/default/original/3X/c/5/c5b0275654af44d99c85963bf2276a04df130da7.png)

---

<div class="post-metadata">

### Author: ![pgh](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/f6c823/32.png) [@pgh](https://community.mp3tag.de/u/pgh)
#### Post date: [January 14, 2025, 5:20am UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/4 "2025-01-14T05:20:39Z")

</div>

I'll change the expression to match yours using | instead of ^.

Yes, I want to sort numbers as text, NOT by number and NOT replacing any spelling in the original name, only in the sort column. For example this order (original spellings):

Fir Song  
Fire  
1st Song  
First Song Next  
4 You  
For You Next  
Four You  
Foremost

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 14, 2025, 6:22am UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/5 "2025-01-14T06:22:24Z")

</div>

> [@pgh](#):
>
> only in the sort column

This will become an almost impossible task.  
The general approach would be to add the following example of an expression to the "sort by" field for the column definition:  
`$replace(%title%,10,ten,9,nine,8,eight,7,seven,6,six,5,five,4,four,3,three,2,two,1,one,0,zero)`  
You would have to start with the biggest number and then go down as e.g. "11" would otherwise be replaced by "oneone" as smaller numbers can be part of larger numbers.  
Also, you have to cater for the order numbers. And you would have to take care of number names in other languages.

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [January 14, 2025, 7:15am UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/6 "2025-01-14T07:15:03Z")

</div>

And not to forget different pronouncing of bands with numbers, for example:

The Rock Band "311" is not pronounced "Three One One" and also not "Threehunderteleven" but "Three Eleven".

---

<div class="post-metadata">

### Author: ![pgh](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/f6c823/32.png) [@pgh](https://community.mp3tag.de/u/pgh)
#### Post date: [January 15, 2025, 3:53pm UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/7 "2025-01-15T15:53:21Z")

</div>

Thanks - I'll think about this because I have a few titles named this way, but I'm not concerned now.

---

<div class="post-metadata">

### Author: ![pgh](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/f6c823/32.png) [@pgh](https://community.mp3tag.de/u/pgh)
#### Post date: [January 15, 2025, 3:54pm UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/8 "2025-01-15T15:54:57Z")

</div>

This looks great, I can't wait to give it a try. Shouldn't take too long because I'll only add the few replacements I need. Thanks!

---

<div class="post-metadata">

### Author: ![MotleyG](https://community.mp3tag.de/user_avatar/community.mp3tag.de/motleyg/32/440_2.png) [@MotleyG](https://community.mp3tag.de/u/MotleyG)
#### Post date: [January 15, 2025, 5:11pm UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/9 "2025-01-15T17:11:31Z")

</div>

> [@pgh](#):
>
> Fir Song  
> Fire  
> 1st Song  
> First Song Next  
> 4 You  
> For You Next  
> Four You  
> Foremost

Even from the list, the interpretation is debatable. Where you have "4 You" this would literally translate to "Four You" but phonetically would be "For You"' for some names. It will be very challenging to create a truly automated solution for these Artistsort changes without going through them manually for accuracy.

---

<div class="post-metadata">

### Author: ![pgh](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/f6c823/32.png) [@pgh](https://community.mp3tag.de/u/pgh)
#### Post date: [January 15, 2025, 5:20pm UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/10 "2025-01-15T17:20:48Z")

</div>

That's okay because I only have a dozen or more phrases to translate. It's just easier for me to see listed alphabetically rather than number at top because not all numbered words begin with numbers and I don't want to look twice, 1st at the top of list and 2nd within the list.

Just hoping someone can help with the expression because I don't know how to code. Thanks!

---

<div class="post-metadata">

### Author: ![pgh](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/f6c823/32.png) [@pgh](https://community.mp3tag.de/u/pgh)
#### Post date: [January 15, 2025, 5:26pm UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/11 "2025-01-15T17:26:43Z")

</div>

This is one reason why I ask for help because I want to add to the expression a handful of replacements such as "112" replaced to sort as "One Twelve" (I may not know whether it's spelled with a number or letter).

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 17, 2025, 6:01pm UTC](https://community.mp3tag.de/t/sorting-artist-treating-numbers-as-text/67140/13 "2025-02-17T18:01:30Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
