# Words Count

**URL:** https://community.mp3tag.de/t/words-count/16029
**Category:** Support
**Created:** [August 19, 2014, 9:49pm UTC](https://community.mp3tag.de/t/words-count/16029 "2014-08-19T21:49:48Z")
**Posts on this page:** 7
**Page:** 1

<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: [August 19, 2014, 9:49pm UTC](https://community.mp3tag.de/t/words-count/16029/1 "2014-08-19T21:49:48Z")

</div>

Hi All,

Trying to find a function that will return a count of total word strings in a field. Is this possible?  
Thanks!

---

<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: [August 20, 2014, 4:18am UTC](https://community.mp3tag.de/t/words-count/16029/2 "2014-08-20T04:18:16Z")

</div>

There is no readymade function for this (I wonder what the application would be).  
You could do something like remove any alphanumeric character (like letters and numbers) and then measure the length of the string as the leftovers should represent the separators.  
You may have to treat the result if there is punctuation and blanks in the string as these count individually.

You could try this

$len($regexp(%title%,\w,))

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [August 20, 2014, 6:37am UTC](https://community.mp3tag.de/t/words-count/16029/3 "2014-08-20T06:37:18Z")

</div>

> [@MotleyG](#):
>
> Hi All, Trying to find a function that will return a count of total word strings in a field. Is this possible? Thanks!

Yes it is possible.  
At first please tell us how do you define a 'word'?  
Which characters are allowed to delimit a word?

For example ... how many words are in the following string?  
Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 3. Rondeau

DD.20140820.1037.CEST

---

<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: [August 20, 2014, 11:46pm UTC](https://community.mp3tag.de/t/words-count/16029/4 "2014-08-20T23:46:19Z")

</div>

Apologies if my original post was vague. In the artist field I wanted to flip FIRSTNAME LASTNAME to LASTNAME, FIRST NAME and also FIRSTNAME MIDDLENAME LASTNAME to LASTNAME, FIRSTNAME MIDDLENAME. The word count function request was to filter the artist field to 2 or 3 word strings in order to try to simply this process, and to run it in larger batches.

In the artist and albumartist fields there tends to be less of a punctuation issue. I'll try your suggestions and work more on a solution. If I have success I will be sure to share.

---

<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: [August 21, 2014, 3:39am UTC](https://community.mp3tag.de/t/words-count/16029/5 "2014-08-21T03:39:34Z")

</div>

> [@MotleyG](#):
>
> ...I wanted to flip FIRSTNAME LASTNAME to LASTNAME, FIRST NAME and also FIRSTNAME MIDDLENAME LASTNAME to LASTNAME, FIRSTNAME MIDDLENAME...

I wouldn't do that.  
Even with the information about the number of words you will create absolutely senseless transformations like

Floyd, Pink  
Zeppelin, Led  
Pink, Kissing the  
Hollywood, Frankie goes to  
etc.  
Or what about artist entries that feature several artists:  
Katrina and the Waves  
Dave Dee, Dozy, Beaky, Mick and Titch  
or the "Friday Night in San Francisco" album by "Al Di Meola, John McLaughlin, Paco De Lucia" (!)

In the end you will never know where to look: for the last name or for the name just the way it is spelled.

Just to give you an idea:  
$cutRight($regexp(%ARTIST%', ','(._?) (\w_), ','$2, $1; '),2)  
transforms  
Pearl Jam, Neil Young  
to  
Jam, Pearl; Young, Neil

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [August 21, 2014, 3:56am UTC](https://community.mp3tag.de/t/words-count/16029/6 "2014-08-21T03:56:22Z")

</div>

> [@MotleyG](#):
>
> Apologies if my original post was vague. In the artist field I wanted to flip FIRSTNAME LASTNAME to LASTNAME, FIRST NAME and also FIRSTNAME MIDDLENAME LASTNAME to LASTNAME, FIRSTNAME MIDDLENAME. ...

Read there ...  
[Regular Expressions](https://community.mp3tag.de/t/521/15)  
[Regular Expressions](https://community.mp3tag.de/t/521/27)  
[Multiple value artist tag to multiple value artistsort](https://community.mp3tag.de/t/12599/1)  
[Need help with regex for ARTISTSORT](https://community.mp3tag.de/t/12653/1)  
[Automating Changes to Artist Values](https://community.mp3tag.de/t/13595/4)

> [@MotleyG](#):
>
> ... The word count function request was to filter the artist field to 2 or 3 word strings in order to try to simply this process, and to run it in larger batches.

Filter for counting "words", which are separated by one or more space characters:

**"$if(%ARTIST%,$add($len($regexp($regexp(%ARTIST%,' +',' '),'[^]',)),1),0)" GREATER 1**

... will display all artists with more than one word.

**"$if(%ARTIST%,$add($len($regexp($regexp(%ARTIST%,' +',' '),'[^]',)),1),0)" IS 3**

... will display all artists with three words.

DD.20140821.0756.CEST

---

<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 9, 2026, 12:25pm UTC](https://community.mp3tag.de/t/words-count/16029/7 "2026-02-09T12:25:12Z")

</div>


