# Count Occurrences of string

**URL:** https://community.mp3tag.de/t/count-occurrences-of-string/63718
**Category:** Support
**Created:** [February 8, 2024, 11:56pm UTC](https://community.mp3tag.de/t/count-occurrences-of-string/63718 "2024-02-08T23:56:31Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mista\_j](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mista_j/32/15808_2.png) [@mista\_j](https://community.mp3tag.de/u/mista_j)
#### Post date: [February 8, 2024, 11:56pm UTC](https://community.mp3tag.de/t/count-occurrences-of-string/63718/1 "2024-02-08T23:56:31Z")

</div>

I'd like to count the number of times a specific string is present withing a field.

My goal is to give my songs an Explicit Score by counting the number of choice words present within the lyrics.

I currently have an explicit rating that checks if the lyrics have a number of "choice words" or those same choice words with \*\* to "censor" the word. For me this indicates a clean version or radio edit of a song.

Id like to be able to count the number of occurrences so that I can see how "problematic" a song may be to play publicly but im not sure where to start

---

<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: [February 9, 2024, 6:21am UTC](https://community.mp3tag.de/t/count-occurrences-of-string/63718/2 "2024-02-09T06:21:17Z")

</div>

This is an expression that tells you the folderdepth in a path:  
`$add($len($regexp(%_path%,'[^\\]',)),1)`  
So, if you replace the chosen word with a symbol and then check the length of the remaining string, the length of the string equals the number of occurrances.

---

<div class="post-metadata">

### Author: ![mista\_j](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mista_j/32/15808_2.png) [@mista\_j](https://community.mp3tag.de/u/mista_j)
#### Post date: [February 9, 2024, 6:52am UTC](https://community.mp3tag.de/t/count-occurrences-of-string/63718/3 "2024-02-09T06:52:03Z")

</div>

Genius, thank you. I will try this 1st thing in the morning

---

<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: [February 9, 2024, 4:56pm UTC](https://community.mp3tag.de/t/count-occurrences-of-string/63718/4 "2024-02-09T16:56:34Z")

</div>

A post was split to a new topic: [How can I add a new line to the lyrics?](https://community.mp3tag.de/t/how-can-i-add-a-new-line-to-the-lyrics/63722)

---

<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: [March 10, 2024, 4:57pm UTC](https://community.mp3tag.de/t/count-occurrences-of-string/63718/5 "2024-03-10T16:57:13Z")

</div>

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