# How to trim YEAR, convert and replace STRING in export file

**URL:** https://community.mp3tag.de/t/how-to-trim-year-convert-and-replace-string-in-export-file/50504
**Category:** Export
**Created:** [October 16, 2020, 6:49pm UTC](https://community.mp3tag.de/t/how-to-trim-year-convert-and-replace-string-in-export-file/50504 "2020-10-16T18:49:15Z")
**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: [October 16, 2020, 6:49pm UTC](https://community.mp3tag.de/t/how-to-trim-year-convert-and-replace-string-in-export-file/50504/1 "2020-10-16T18:49:15Z")

</div>

I want to export %year% in a format that will be used in HTML later. My songs have the following format "2020-09-21T07:00:00Z" and sometimes "2020-09-21".

I want to transform it into the Brazilian format: "DD de MM de YYYY" and also replace MM with the Portuguese word equivalent. For example, you have "February 24, 2020", and in Brazil it would be "24 de Fevereiro de 2020".

1º how to achieve the desired year format and how to replace accordingly in the export file? Can it be done with 12 ifs? I started with something like:

```
$if( "MM" from "DD de MM de YYYY" = 01 , $replace(%year%,01,Janeiro)], do nothing )
$if( "MM" from "DD de MM de YYYY" = 02 , $replace(%year%,02,Fevereiro)], do nothing )
$if( "MM" from "DD de MM de YYYY" = 03 , $replace(%year%,03,Março)], do nothing )

```

I appreciate any help very much.

---

<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: [October 16, 2020, 7:04pm UTC](https://community.mp3tag.de/t/how-to-trim-year-convert-and-replace-string-in-export-file/50504/2 "2020-10-16T19:04:57Z")

</div>

> [@henriquebs12](#):
>
> 2020-09-21T07:00:00Z

To get that into the

> [@henriquebs12](#):
>
> Brazilian format: "DD de MM de YYYY"

Try  
`$regexp(%year%,'(\d+)\-(\d+)\-(\d+)T.*','$3 de $2 de $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: [October 16, 2020, 7:26pm UTC](https://community.mp3tag.de/t/how-to-trim-year-convert-and-replace-string-in-export-file/50504/3 "2020-10-16T19:26:08Z")

</div>

Hi again, it works for the first part for the problem. Thank you for that. Now I'm trying to reutilize the variable "$2" and replace accordingly to my needs, but it seems not to work with `$replace($2,from,to)` or `$puts($2,y)`. What am I doing wrong?

---

<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: [October 16, 2020, 7:28pm UTC](https://community.mp3tag.de/t/how-to-trim-year-convert-and-replace-string-in-export-file/50504/4 "2020-10-16T19:28:48Z")

</div>

Yep, that does not work right, try something really longish:  
`$regexp(%year%,'(\d+)\-(\d+)\-(\d+)T.*','$3 de') $replace($regexp(%year%,'(\d+)\-(\d+)\-(\d+)T.*','$2'),09,Septembre) de $regexp(%year%,'(\d+)\-(\d+)\-(\d+)T.*','$1')`

You have to add in the $replace() statement the list of number/month pairs

---

<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: [October 16, 2020, 8:46pm UTC](https://community.mp3tag.de/t/how-to-trim-year-convert-and-replace-string-in-export-file/50504/5 "2020-10-16T20:46:05Z")

</div>

Worked perfectly. Thank you!
