# Guess value or Format value?

**URL:** <https://community.mp3tag.de/t/guess-value-or-format-value/19547>\
**Category:** Support\
**Created:** [November 21, 2017, 6:16pm UTC](https://community.mp3tag.de/t/guess-value-or-format-value/19547 "2017-11-21T18:16:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![henriquebs12](https://community.mp3tag.de/user_avatar/community.mp3tag.de/henriquebs12/32/8205_2.png) [@henriquebs12](https://community.mp3tag.de/u/henriquebs12)\
**Post date:** [November 21, 2017, 6:16pm UTC](https://community.mp3tag.de/t/guess-value-or-format-value/19547/1 "2017-11-21T18:16:17Z")

</div>

My genre filed have several genres, separated by comma (Dance, Electro, Reggae), and I wanted to replace it with only the first item of the string.

Before\> Dance, Electro, Reggae  
After\> Dance

How can I do it? With Guess Value or Format Value? I could not find how to say witch one is the first, second, or third value..

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [November 21, 2017, 6:34pm UTC](https://community.mp3tag.de/t/guess-value-or-format-value/19547/2 "2017-11-21T18:34:28Z")

</div>

Replace with regular expression is the most robust method here. (you could use below reg exp in the format function too)

Replace

^([^,]+?),.\*

With

$1

Format method

$regexp(%genre%,'^([^,]+?),.\*',$1)

---

<div class="post-metadata">

**Author:** ![henriquebs12](https://community.mp3tag.de/user_avatar/community.mp3tag.de/henriquebs12/32/8205_2.png) [@henriquebs12](https://community.mp3tag.de/u/henriquebs12)\
**Post date:** [November 21, 2017, 7:00pm UTC](https://community.mp3tag.de/t/guess-value-or-format-value/19547/3 "2017-11-21T19:00:07Z")

</div>

> [@stevehero](#):
>
> Replace with regular expression is the most robust method here. (you could use below reg exp in the format function too)
> 
> Replace
> 
> ^([^,]+?),.\*
> 
> With
> 
> $1
> 
> Format method
> 
> $regexp(%genre%,'^([^,]+?),.\*',$1)

Thank you very much. You're a genius.

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [November 21, 2017, 7:04pm UTC](https://community.mp3tag.de/t/guess-value-or-format-value/19547/4 "2017-11-21T19:04:50Z")

</div>

> [@Henrique Barcelos](#):
>
> Thank you very much. You're a ~~genius~~.

Nah, thanks though.

Just been using this program and learning reg exp for many years.

---

<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 7, 2019, 2:24am UTC](https://community.mp3tag.de/t/guess-value-or-format-value/19547/5 "2019-02-07T02:24:50Z")

</div>

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