# Copy first 2 characters to field

**URL:** https://community.mp3tag.de/t/copy-first-2-characters-to-field/13631
**Category:** Support
**Created:** [July 10, 2012, 10:10pm UTC](https://community.mp3tag.de/t/copy-first-2-characters-to-field/13631 "2012-07-10T22:10:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![w1nta](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/ecc23a/32.png) [@w1nta](https://community.mp3tag.de/u/w1nta)
#### Post date: [July 10, 2012, 10:10pm UTC](https://community.mp3tag.de/t/copy-first-2-characters-to-field/13631/1 "2012-07-10T22:10:25Z")

</div>

Hi,

I know this is going to be simple but I have been searchin the FAQ and forum for an hour and what I have tried isn't working. I want to copy the first 2 characters from the filename to the discnumber.

Filenames look like "36Albumname122.mp3"

I want the 36 to become the discnumber

Thanks.

---

<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: [July 10, 2012, 11:55pm UTC](https://community.mp3tag.de/t/copy-first-2-characters-to-field/13631/2 "2012-07-10T23:55:54Z")

</div>

> [@w1nta](#):
>
> Filenames look like "36Albumname122.mp3"
> 
> I want the 36 to become the discnumber
> 
> Thanks.

Use format action  
field: DISCNUMBER  
value: $regexp(%\_FILENAME%,'^(d+).+',$1)

---

<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: [July 11, 2012, 1:34am UTC](https://community.mp3tag.de/t/copy-first-2-characters-to-field/13631/3 "2012-07-11T01:34:01Z")

</div>

> [@w1nta](#):
>
> ... I want to copy the first 2 characters from the filename to the discnumber. Filenames look like "36Albumname122.mp3" I want the 36 to become the discnumber ...

**Action: Format value**  
... or ...  
**Converter: Tag - Tag**

Field: DISCNUMBER  
_(fetch two leading characters)_  
Value/Format string: **$left(%\_filename%,2)**  
... or ...  
_(fetch two leading characters)_  
Value/Format string: **$reverse($right($reverse(%\_filename%),2))**  
... or ...  
_(fetch two leading digits)_  
Value/Format string: **$regexp(%\_filename%,'^(\d\d).+$','$1')**  
... or ...  
_(fetch all leading digits)_  
Value/Format string: **$regexp(%\_filename%,'^(\d+).+$','$1')**

DD.20120711.0540.CEST

---

<div class="post-metadata">

### Author: ![w1nta](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/ecc23a/32.png) [@w1nta](https://community.mp3tag.de/u/w1nta)
#### Post date: [July 11, 2012, 3:11am UTC](https://community.mp3tag.de/t/copy-first-2-characters-to-field/13631/4 "2012-07-11T03:11:49Z")

</div>

Cheers guys.

This one worked for me

Action: Format value  
Field: DISCNUMBER  
Format string: $left(%\_filename%,2)

1200 files in 5 seconds. BAM!

---

<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 9, 2026, 12:23pm UTC](https://community.mp3tag.de/t/copy-first-2-characters-to-field/13631/5 "2026-02-09T12:23:56Z")

</div>


