# Insert dashes for date

**URL:** https://community.mp3tag.de/t/insert-dashes-for-date/66212
**Category:** Support
**Created:** [October 9, 2024, 11:41pm UTC](https://community.mp3tag.de/t/insert-dashes-for-date/66212 "2024-10-09T23:41:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Stev\_Jackson](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Stev\_Jackson](https://community.mp3tag.de/u/Stev_Jackson)
#### Post date: [October 9, 2024, 11:41pm UTC](https://community.mp3tag.de/t/insert-dashes-for-date/66212/1 "2024-10-09T23:41:25Z")

</div>

Hi. I took a break from tagging files that I record off FM and I forgot my way of working.  
I have the date recorded in the comment field as "20240314" (which would be YYYYMMDD).

I want to rename the files from "20240314" - Title to "2024-03-14 - Title"

So is there something I can do with Tag-\>Filename to rename the files?

---

<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: [October 10, 2024, 6:18am UTC](https://community.mp3tag.de/t/insert-dashes-for-date/66212/2 "2024-10-10T06:18:45Z")

</div>

> [@Stev\_Jackson](#):
>
> 20240314  
> So is there something I can do with Tag-\>Filename to rename the files?

You can try  
`$regexp(%COMMENT%,(\d{4})(\d{2})(\d{2}),$1-$2-$3) - %TITLE%`

![image](https://community.mp3tag.de/uploads/default/original/3X/0/c/0cfda9e25abded325adc58fd245f0721ffb8db5c.png)

This only works correctly if the numbers in COMMENT are really arranged as YYYYMMDD.

---

<div class="post-metadata">

### Author: ![Casual\_Tea](https://community.mp3tag.de/user_avatar/community.mp3tag.de/casual_tea/32/18886_2.png) [@Casual\_Tea](https://community.mp3tag.de/u/Casual_Tea)
#### Post date: [October 10, 2024, 10:29am UTC](https://community.mp3tag.de/t/insert-dashes-for-date/66212/3 "2024-10-10T10:29:22Z")

</div>

Since I love regex I thought I'd try to improve yours a bit.

```auto
^((?:19|20)\d{2})((?:0[1-9]|1[0-2]))(\d{2})$

```

 ![grafik](https://community.mp3tag.de/uploads/default/original/3X/8/8/8803467662194e65fb6f1a3cd45d0658ec4ade13.png)

This only matches when the first 4 digits start with 19 or 20 (for 19th and 20th century) and the 2 digits that follow must be between 01 and 12 for months.  
The only cases where this still might fail is when you have switched days and months and the day is within the 01-12 range.

---

<div class="post-metadata">

### Author: ![Stev\_Jackson](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Stev\_Jackson](https://community.mp3tag.de/u/Stev_Jackson)
#### Post date: [October 10, 2024, 11:41am UTC](https://community.mp3tag.de/t/insert-dashes-for-date/66212/4 "2024-10-10T11:41:19Z")

</div>

I tried LyricsLover's idea and it worked perfectly. Thank you

---

<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: [November 9, 2024, 11:41am UTC](https://community.mp3tag.de/t/insert-dashes-for-date/66212/5 "2024-11-09T11:41:48Z")

</div>

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