# Add Date Month Year from Discogs

**URL:** https://community.mp3tag.de/t/add-date-month-year-from-discogs/7263
**Category:** Web Sources Discussion
**Created:** [October 1, 2008, 11:18am UTC](https://community.mp3tag.de/t/add-date-month-year-from-discogs/7263 "2008-10-01T11:18:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![TerzOpperator](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/8dc957/32.png) [@TerzOpperator](https://community.mp3tag.de/u/TerzOpperator)
#### Post date: [October 1, 2008, 11:18am UTC](https://community.mp3tag.de/t/add-date-month-year-from-discogs/7263/1 "2008-10-01T11:18:54Z")

</div>

Hi@All

I want to add the Released date (21 Mar 2008) from Discogs to the tag.  
But i do not understand the regex script from mp3tag 2.41.

I tryed to Search for the Date and want to Format it.  
21 Mar 2008

my Script:

```
^(?<Day>(31(?! (Feb|Apr|Jun|Sep|Nov)))|((30|29)(?! Feb))|(29(?= Feb(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\d|2[0-8]) (?<Month>Jan|Feb|Mar|May|Apr|Jul|Jun|Aug|Oct|Sep|Nov|Dec) (?<Year>(1[6-9]|[2-9]\d)\d{2})$

```

RegEx Replacement:

```
$& [${Year}-${Month}-${Day}]

```

Result:  
2008-Mar-26

In mp3 tag i get following error:

```
Invalid preceding regular expression22

```

I have Checked this Regex online. And it works, but not in mp3tag.  
(Later i want to rewrite it in YYYY-MM-DD) (2008-03-26)

My Question: What is the error? or can i bypass this regex?

Big thx for any reply. 😉 And sorry 4 my english, but my german is better. 😉

---

<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: [October 1, 2008, 2:29pm UTC](https://community.mp3tag.de/t/add-date-month-year-from-discogs/7263/2 "2008-10-01T14:29:24Z")

</div>

> [@TerzOpperator](#):
>
> ... I want to add the Released date (21 Mar 2008) from Discogs to the tag.  
> But i do not understand the regex script from mp3tag 2.41.  
> I tryed to Search for the Date and want to Format it.  
> 21 Mar 2008 ...

There are some special characters in Mp3tag, which have to be escaped when using Mp3tag regex abilities, e. g. [ should become '['. There might be other syntax specials too, which prevent you from running your fine composed regex string.

Try this instead:

```
$replace($regexp('21 Mar 2008',^(\d{1,2}) (.+?) (\d{4})$,$3-$2-$1),
Jan,01,Feb,02,Mar,03,Apr,04,May,05,Jun,06,Jul,07,Aug,08,Sep,09,Oct,10,Nov,11,Dec
,12)

```

DD.20081001.1830.CEST

---

<div class="post-metadata">

### Author: ![TerzOpperator](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/8dc957/32.png) [@TerzOpperator](https://community.mp3tag.de/u/TerzOpperator)
#### Post date: [October 6, 2008, 8:49am UTC](https://community.mp3tag.de/t/add-date-month-year-from-discogs/7263/3 "2008-10-06T08:49:15Z")

</div>

Hi DetlevD,

thank you for your answer. I understand your sting and I tried to repace my string with yours, but i have the same problem.

```
Invalid preceding regular expression22

```

Can you give me an little code example?

---

<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: [October 6, 2008, 1:46pm UTC](https://community.mp3tag.de/t/add-date-month-year-from-discogs/7263/4 "2008-10-06T13:46:43Z")

</div>

> [@TerzOpperator](#):
>
> Can you give me an little code example?

Well, my example is an example par excellence, which will create valid output by itself.  
You may try to run an action 'tagfield format' against a sample track using fieldname 'test' and as formatstring the complete example string from above. The result should be: new tagfield 'TEST' containing string value '2008-03-21'.

> [@TerzOpperator](#):
>
> Invalid preceding regular expression22

Try to reduce your erroneous regular expression to a minimalistic format, use some simple basic regex rule and see what happens. If the result is ok, then try a more advanced regex rule, ..., and so on, until you've catched the problem. Make sure that you use the appropriate regex syntax for Mp3tag.

DD.20081006.1745.CEST
