# Modifying or Moving a Determinate Number of Characters In a Field

**URL:** <https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407>\
**Category:** Support\
**Created:** [December 31, 2020, 12:34pm UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407 "2020-12-31T12:34:44Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ragtag](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ragtag/32/13146_2.png) [@ragtag](https://community.mp3tag.de/u/ragtag)\
**Post date:** [December 31, 2020, 12:34pm UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/1 "2020-12-31T12:34:44Z")

</div>

Hello Everybody,

If you would, please help me out with a tagging problem, which I am still unable to figure out by myself after several hours. What I wish to do, is the following:

Replace a determinate number of characters located at the end of the TITLE-field. In this case, the number of characters due for replacement are 4 numerals. These 4 numerals are to be replaced with the exact same numerals, but only now encased in curly braces.

I have tried ACTION-type: "Replace with regular expression" for this purpose, using the regular expression **.{4}$** found on the forum. However, poor RE-skills hamper my best efforts at "Replace matches with" to produce the desired results.

How does one put those last 4 characters, say 1234 in the TITLE, with this: {1234}?

Thank you.

---

<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:** [December 31, 2020, 12:58pm UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/2 "2020-12-31T12:58:21Z")

</div>

> [@ragtag](#):
>
> put those last 4 characters, say 1234

Perhaps like this:  
`$regexp('put those last 4 characters, say 1234',(.*) (\d+),$1 {$2})`  
-\>put those last 4 characters, say {1234}

---

<div class="post-metadata">

**Author:** ![ragtag](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ragtag/32/13146_2.png) [@ragtag](https://community.mp3tag.de/u/ragtag)\
**Post date:** [December 31, 2020, 1:56pm UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/3 "2020-12-31T13:56:59Z")

</div>

Thank you, Ohrenkino.

The given regular expression did not deliver the expected results, and I apologize for not having expressed myself clearly. Perhaps the following examples of two titles are more to the point. The last 4 characters of the FIELD, highlighted below in bold, need to be replaced the way shown:

**Example 1**  
Original Text: Just Out Of Reach **1952**  
Changed FIELD: Just Out Of Reach **{1952}**

**Example 2**  
Original Text: We're Talking It Over **1959**  
Changed FIELD: We're Talking It Over **{1959}**

---

<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:** [December 31, 2020, 2:01pm UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/4 "2020-12-31T14:01:20Z")

</div>

Then I don't know what you did.  
`$regexp('put those last 4 characters, say 1234',(.*) (\d+),$1 {$2})`  
delievers exactly the modification that you showed.  
If you have a variable text, then you have to enter the source for the variable text first or name it, e.g.  
`$regexp(%title%,(.*) (\d+),$1 {$2})`  
will treat that what is found in TITLE.

---

<div class="post-metadata">

**Author:** ![ragtag](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ragtag/32/13146_2.png) [@ragtag](https://community.mp3tag.de/u/ragtag)\
**Post date:** [December 31, 2020, 2:07pm UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/5 "2020-12-31T14:07:30Z")

</div>

Thank you, I will try again.

---

<div class="post-metadata">

**Author:** ![ragtag](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ragtag/32/13146_2.png) [@ragtag](https://community.mp3tag.de/u/ragtag)\
**Post date:** [December 31, 2020, 2:18pm UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/6 "2020-12-31T14:18:47Z")

</div>

It is obvious that I am not applying your solution correctly, because this is the result of 3 tracks tested:

**Application**  
 ![image](https://community.mp3tag.de/uploads/default/original/2X/4/4c9dfb8a5de0556a339f1943a4394c13d85fb63f.png)

**Result**  
 ![image](https://community.mp3tag.de/uploads/default/original/2X/d/d2e4cd11351e634b3d8069f385d37be7ede89eff.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:** [December 31, 2020, 2:22pm UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/7 "2020-12-31T14:22:45Z")

</div>

If you use scripting functions like $regexp() you have to use a function that allows a "Format string".  
So you either change the action type to "Format value" for TITLE and then you can use the $regexp() function or you adapt the "Replace with regular expression" action to  
Regular expression: `(.*) (\d+)`  
Replace with: `$1 {$2}`

---

<div class="post-metadata">

**Author:** ![ragtag](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ragtag/32/13146_2.png) [@ragtag](https://community.mp3tag.de/u/ragtag)\
**Post date:** [December 31, 2020, 2:29pm UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/8 "2020-12-31T14:29:37Z")

</div>

Thank you very much for clarifying that, Ohrenkino, and thank you too, for consistently being here for us who need your expert assistance.

A very happy and prosperous New Year to you.

---

<div class="post-metadata">

**Author:** ![ragtag](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ragtag/32/13146_2.png) [@ragtag](https://community.mp3tag.de/u/ragtag)\
**Post date:** [December 31, 2020, 3:53pm UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/9 "2020-12-31T15:53:24Z")

</div>

> If you use scripting functions like $regexp() you have to use a function that allows a "Format string".  
> So you either change the action type to "Format value" for TITLE and then you can use the $regexp() function or you adapt the "Replace with regular expression" action to  
> Regular expression: (.\*) (\d+)  
> Replace with: $1 {$2}

It did all work out precisely, thank you.

For my clarification, does the expression given above, namely (.\*) (\d+) apply to numerals only, and if so, how does it have to be modified if it were 4 alphabetical characters to be replaced?

---

<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:** [December 31, 2020, 4:01pm UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/10 "2020-12-31T16:01:40Z")

</div>

See the help on the syntax in regular expressions:

> **[Replace with Regular Expression – Mp3tag Documentation](https://docs.mp3tag.de/actions/replace-regexp/)**
>
> Documentation on the Replace with Regular Expression action type that can be performed as Quick Action or as reusable workflow from Action Groups. Mp3tag is the universal Tag Editor.

You will find that my suggestion did not take into account that there were 4 digits but it defined a pattern of any characters followed by a number of any length.  
To do something with 4 characters, it could be easiest to use  
`....`  
but this would really include anything, even spaces, digits, punctuation.  
So a closer look at what the pattern looks like would be of benefit.  
To simply cut a number of characters from either end of a string (or even the middle) see the scripting functions:

> **[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/#string-functions)**
>
> Documentation on Mp3tag's scripting functions. Mp3tag is the universal Tag Editor.

like $left(), $cutleft() etc.

---

<div class="post-metadata">

**Author:** ![ragtag](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ragtag/32/13146_2.png) [@ragtag](https://community.mp3tag.de/u/ragtag)\
**Post date:** [January 1, 2021, 5:52am UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/11 "2021-01-01T05:52:59Z")

</div>

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

---

<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:** [January 31, 2021, 5:53am UTC](https://community.mp3tag.de/t/modifying-or-moving-a-determinate-number-of-characters-in-a-field/51407/12 "2021-01-31T05:53:03Z")

</div>

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