# Copy inside TITLE () data to file name with regexp()

**URL:** <https://community.mp3tag.de/t/copy-inside-title-data-to-file-name-with-regexp/18744>\
**Category:** Support\
**Created:** [February 23, 2017, 7:56pm UTC](https://community.mp3tag.de/t/copy-inside-title-data-to-file-name-with-regexp/18744 "2017-02-23T19:56:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kittmaster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kittmaster/32/14793_2.png) [@kittmaster](https://community.mp3tag.de/u/kittmaster)\
**Post date:** [February 23, 2017, 7:56pm UTC](https://community.mp3tag.de/t/copy-inside-title-data-to-file-name-with-regexp/18744/1 "2017-02-23T19:56:49Z")

</div>

Hi Guys,

I'm trying to figure out how to capture a piece of the title tag that I create with my scripts. It denotes video resolution in the title and I want that to be captured by the file rename.

My files names should look like this:

VIDEO FILE--HD MOTION BACKGROUND (8) (1080P)--RESOLUTION(1080P).mp4

So for each file the title is appended and will have its own resolution value that could be anything from 1080P to 720P to etc. looking like this in the title field:

HD MOTION BACKGROUND (8) (1080P)

So my tag to file rename all works but the $regexp part shown below.

I want to capture the 1080P inside the parenthesis and dump it into the the file name since is a wildcard for all my MP4s.

What am I doing wrong? I don't use regexp much, so I assume it's a syntax problem, but I'm not getting a syntax error in the preview file name.

$caps2($if2(%artist%,NULL))--$caps2($if2(%title%,NULL))--RESOLUTION($regexp(%title%,\d\*(.\*)))

Any thoughts?

TY.

---

<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:** [February 23, 2017, 8:32pm UTC](https://community.mp3tag.de/t/copy-inside-title-data-to-file-name-with-regexp/18744/2 "2017-02-23T20:32:04Z")

</div>

> [@kittmaster](#):
>
> ...but I'm not getting a syntax error in the preview file name.

If you do not get any syntax errors, it should be a logical error. So where do you have the problems?

---

<div class="post-metadata">

**Author:** ![kittmaster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kittmaster/32/14793_2.png) [@kittmaster](https://community.mp3tag.de/u/kittmaster)\
**Post date:** [February 23, 2017, 9:36pm UTC](https://community.mp3tag.de/t/copy-inside-title-data-to-file-name-with-regexp/18744/3 "2017-02-23T21:36:11Z")

</div>

> [@ohrenkino](#):
>
> If you do not get any syntax errors, it should be a logical error. So where do you have the problems?

I've attached an image to show that I would expect to see the 720P inside the name, but since I'm using \d, it would only be the 720 without the P, but as you can see, there is nothing in the () at all.

 ![](https://community.mp3tag.de/uploads/default/original/2X/d/d82ce1911f99512d3adb8582f71900d1b733ba81.png)

---

<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:** [February 24, 2017, 5:43am UTC](https://community.mp3tag.de/t/copy-inside-title-data-to-file-name-with-regexp/18744/4 "2017-02-24T05:43:09Z")

</div>

> [@kittmaster](#):
>
> I've attached an image to show that I would expect to see the 720P inside the name, but since I'm using \d, it would only be the 720 without the P, but as you can see, there is nothing in the () at all.

I think that this part  
$regexp(%title%,\d\*(._))  
should read  
$regexp(%title%,'._((\d+))',$1p)

---

<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:** [February 24, 2017, 9:04am UTC](https://community.mp3tag.de/t/copy-inside-title-data-to-file-name-with-regexp/18744/5 "2017-02-24T09:04:07Z")

</div>

> [@kittmaster](#):
>
> ... It denotes video resolution in the title ...

**$regexp('HD MOTION BACKGROUND (8) (1080P)','^.\*\((.+P)\)$','$1') ==\> '1080P'**

DD.20170224.1104.CET

---

<div class="post-metadata">

**Author:** ![kittmaster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kittmaster/32/14793_2.png) [@kittmaster](https://community.mp3tag.de/u/kittmaster)\
**Post date:** [February 24, 2017, 3:14pm UTC](https://community.mp3tag.de/t/copy-inside-title-data-to-file-name-with-regexp/18744/6 "2017-02-24T15:14:37Z")

</div>

Hi Guys,

I've tried both solutions, I've attached screenshots to show the result.

One result still has entire title and 720 included.

Other result also puts 1080 instead of the wildcard change.

As you can see, not all my files are 1080, so I'm trying to have it copy only the numbers minus the P and I can format the rest. I'm only trying to capture the digits.

There my be other () like (Clean) or (Dirty) that I don't want to capture if it was in the title also. I just want to capture the numbers.

Any thoughts on how to tweak?

TY.

 ![](https://community.mp3tag.de/uploads/default/original/2X/4/414956cb07cd54109b0c7c6d3f92453c669aacdb.png)  

 ![](https://community.mp3tag.de/uploads/default/original/2X/7/7f5250d7907ba4ea7a99d092fdc4103c5e3c362d.png)

---

<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:** [February 24, 2017, 3:35pm UTC](https://community.mp3tag.de/t/copy-inside-title-data-to-file-name-with-regexp/18744/7 "2017-02-24T15:35:33Z")

</div>

> [@kittmaster](#):
>
> ... result also puts 1080 instead of the wildcard change. As you can see, not all my files are 1080, so I'm trying to have it copy only the numbers minus the P and I can format the rest. I'm only trying to capture the digits. ...

Your screenshot shows that you apparently did not understand my proposal and therefore you have applicated it in no good way.

Here is another example, which fetches the number string at the left side from the letter "P" within the rightmost () round bracket clamb.

$regexp('HD MOTION BACKGROUND (8) (1080P)','^.\*((\d+)P)$','$1') ==\> '1080'

You have to adapt the formatstring resp. the regular expression to work on the correct tagfield,  
e.g.

**$regexp(%TITLE%,'^.\*\((\d+)P\)$','$1')**

DD.20170224.1735.CET

---

<div class="post-metadata">

**Author:** ![kittmaster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kittmaster/32/14793_2.png) [@kittmaster](https://community.mp3tag.de/u/kittmaster)\
**Post date:** [February 24, 2017, 5:56pm UTC](https://community.mp3tag.de/t/copy-inside-title-data-to-file-name-with-regexp/18744/8 "2017-02-24T17:56:36Z")

</div>

> [@DetlevD](#):
>
> Your screenshot shows that you apparently did not understand my proposal and therefore you have applicated it in no good way.
> 
> Here is another example, which fetches the number string at the left side from the letter "P" within the rightmost () round bracket clamb.
> 
> $regexp('HD MOTION BACKGROUND (8) (1080P)','^.\*((\d+)P)$','$1') ==\> '1080'
> 
> You have to adapt the formatstring resp. the regular expression to work on the correct tagfield,  
> e.g.
> 
> **$regexp(%TITLE%,'^.\*\((\d+)P\)$','$1')**
> 
> DD.20170224.1735.CET

Well part of it was I wasn't entirely sure since the first part was the fix part of the single file string. So my understanding was limited. Seeing the additional example you provided, it has become clear on how to do this and do it correctly.

Thank you for the additional help!

Chris

---

<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:26pm UTC](https://community.mp3tag.de/t/copy-inside-title-data-to-file-name-with-regexp/18744/9 "2026-02-09T12:26:41Z")

</div>


