# Removing a specific value - but only for a specific fileformat

**URL:** https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435
**Category:** Support
**Created:** [February 22, 2022, 6:29pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435 "2022-02-22T18:29:41Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)
#### Post date: [February 22, 2022, 6:29pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/1 "2022-02-22T18:29:41Z")

</div>

Sometimes my TTA files have `tta` or `TTA` written in their `_FIENAME`s, i.e. before the extension

Something as simple as just replacing " tta" with disregard for case-sensitive comparison in `TITLE` field does the trick. And I use that single pause [i.e. " tta" instead of "tta"] as a fail-safe - but I would like to add another layer to it:

I need to make this action work only for files in TTA format, which will reduce the number of wrong usages thus error [thus data loss]

So how do I do that? I am guessing I would need to use `Replace with regular expression` instead of ordinary `Replace`

---

<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: [February 22, 2022, 6:31pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/2 "2022-02-22T18:31:02Z")

</div>

Just use a filter F3 first to reduce your list to your TTA files.  
Then execute your action to this filtered list of files.

---

<div class="post-metadata">

### Author: ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)
#### Post date: [February 22, 2022, 7:14pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/3 "2022-02-22T19:14:48Z")

</div>

But I need this as an single action; as in using a single groups action and not combining it with other Mp3tag features

---

<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: [February 22, 2022, 7:16pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/4 "2022-02-22T19:16:49Z")

</div>

@ohrenkino explains [here](https://community.mp3tag.de/t/adding-filters-to-actions/42343/2) why it is not possible to use a filter in a action.

---

<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 22, 2022, 7:24pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/5 "2022-02-22T19:24:09Z")

</div>

> [@Zerow](#):
>
> I am guessing I would need to use `Replace with regular expression` instead of ordinary `Replace`

If you replace a text constant with another text constant (in this case constantly nothing) then you only need an action of the type "Replace".

I have just scanned my collection and found "Whole lotta love", "Gotta be strarting something", "Loretta", "Violetta" as part of a Verdi opera, "Outtake" as part of a title, "Attack of the clones" - so there are a lot of titles (and probably filenames) with tta in them  
I also wonder how the presence of these 3 letters would lead to

> [@Zerow](#):
>
> data loss

---

<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: [February 22, 2022, 7:36pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/6 "2022-02-22T19:36:44Z")

</div>

> [@Zerow](#):
>
> But I need this as an single action; as in using a single groups action and not combining it with other Mp3tag features

If you really want to go that way, you could use something like this in your "Format value" action:  
`$if($eql('TTA',$upper(%_extension%)),$repl(%TITLE%,' tta ',' '),)`

> **Please don't use this abbreviated syntax!**
>
> As found in this [bug report](https://community.mp3tag.de/t/similar-actions-get-mixed-up/56456), the abbrevation of `$repl` instead of using `$replace` can result in unwanted changes. Always use `$replace` as stated in the [help.](https://docs.mp3tag.de/scripting/#string-functions)

This would replace the text `space tta space` with a single `space` whenever the extension of the current file is TTA. You have to adjust it to your needs and use cases.

As @ohrenkino told you: This will also remove the bold marked text from titles:  
Let **tta** and Cathode  
or  
Too young **tta** way

---

<div class="post-metadata">

### Author: ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)
#### Post date: [February 23, 2022, 3:06pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/7 "2022-02-23T15:06:18Z")

</div>

> [@ohrenkino](#):
>
> [...]  
> I have just scanned my collection and found "Whole lotta love", "Gotta be strarting something", "Loretta", "Violetta" as part of a Verdi opera, "Outtake" as part of a title, "Attack of the clones" - so there are a lot of titles (and probably filenames) with tta in them  
> I also wonder how the presence of these 3 letters would lead to
> 
> > [@Zerow](#):
> >
> > data loss

> [@LyricsLover](#):
>
> [...]  
> As @ohrenkino told you: This will also remove the bold marked text from titles:  
> Let **tta** and Cathode  
> or  
> Too young **tta** way

Either I am unable to imagine negative consequence - or both of you did not understand me  
` `  
` `  
The data loss will occur precisely in such cases like @ohrenkino examples - if I will not use the first fail safe [i.e. " tta" with a pause]

All in all, based on this

> [@LyricsLover](#):
>
> > [@Zerow](#):
> >
> > But I need this as an single action; as in using a single groups action and not combining it with other Mp3tag features
> 
> If you really want to go that way, you could use something like this in your "Format value" action:  
> `$if($eql('TTA',$upper(%_extension%)),$repl(%TITLE%,' tta ',' '),)`
> 
> [...]

I went with

```auto
$if($eql('TTA',$upper(%_EXTENSION%)),$repl(%TITLE%,' tta',' '),)
$if($eql('TTA',$upper(%_EXTENSION%)),$repl(%TITLE%,' TTA',' '),)
$if($eql('TTA',$lower(%_EXTENSION%)),$repl(%TITLE%,' tta',' '),)
$if($eql('TTA',$lower(%_EXTENSION%)),$repl(%TITLE%,' TTA',' '),)

```

as I failed at adding `The fourth optional parameter enables ignore case (1)` [[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting)]; i.e. those did not work

```auto
$if($eql('TTA',$upper(%_EXTENSION%)),$repl(%TITLE%,' tta',' ',1),)
$if($eql('TTA',$lower(%_EXTENSION%)),$repl(%TITLE%,' tta',' ',1),)

```

and neither did those

```auto
$if($eql('TTA',$upper(%_EXTENSION%)),$repl(%TITLE%,' tta',' '),1)
$if($eql('TTA',$lower(%_EXTENSION%)),$repl(%TITLE%,' tta',' '),1)

```

` `  
` `  
And on the side note- I stumbled upon a bug: [Similar actions get mixed up when using abbreviated function name](https://community.mp3tag.de/t/similar-actions-get-mixed-up/56456)

---

<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: [February 23, 2022, 3:15pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/8 "2022-02-23T15:15:02Z")

</div>

Either you use `$upper` with the extension comparison in UPPERCASE

```auto
$if($eql('TTA',$upper(%_EXTENSION%)),$repl(%TITLE%,' TTA',' '),)

```

or you use `$lower` with the extension comparison in lowercase

```auto
$if($eql('tta',$lower(%_EXTENSION%)),$repl(%TITLE%,' TTA',' '),)

```

Do you want to replace the tta string in all variations like `tta`, `tTa`, `tTA`, `TTa`, `ttA`, `TTA`?  
Or what case should be ignored?

**Later added warning:**

> **Please don't use this abbreviated syntax!**
>
> As found in this [bug report](https://community.mp3tag.de/t/similar-actions-get-mixed-up/56456), the abbrevation of `$repl` instead of using `$replace` can result in unwanted changes. Always use `$replace` as stated in the [help.](https://docs.mp3tag.de/scripting/#string-functions)

---

<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, 2022, 4:05pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/9 "2022-02-23T16:05:58Z")

</div>

> [@Zerow](#):
>
> as I failed at adding `The fourth optional parameter enables ignore case (1)`

In $replace() is no fourth optional parameter to ignore the case, in fact  
"Functions with variable parameter count (e.g., Replace) are limited to \< 64 parameters"

---

<div class="post-metadata">

### Author: ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)
#### Post date: [February 23, 2022, 4:15pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/10 "2022-02-23T16:15:57Z")

</div>

> [@LyricsLover](#):
>
> [...]  
> Do you want to replace the tta string in all variations like `tta`, `tTa`, `tTA`, `TTa`, `ttA`, `TTA`?  
> Or what case should be ignored?

All variants

They are unlikely but can happen, but as I am at it I should address altogether that very rare issue - but adding to the code all variants manually will be a tedious task

---

<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, 2022, 4:27pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/11 "2022-02-23T16:27:32Z")

</div>

> [@Zerow](#):
>
> but adding to the code all variants manually will be a tedious task

You can die only one death: either you use the filter and a plain replace action that ignores the case or you enclose the whole thing in a complicated $IF() but then you have to mention all iterations.

---

<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: [March 25, 2022, 4:28pm UTC](https://community.mp3tag.de/t/removing-a-specific-value-but-only-for-a-specific-fileformat/56435/12 "2022-03-25T16:28:21Z")

</div>

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