# Replace with regexp filename

**URL:** https://community.mp3tag.de/t/replace-with-regexp-filename/9811
**Category:** Support
**Created:** [February 1, 2010, 3:49pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811 "2010-02-01T15:49:46Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [February 1, 2010, 3:49pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/1 "2010-02-01T15:49:46Z")

</div>

This Action has doesn't work. How should I adjust to get it to set the filename to XXX?

```
Replace with regular expression

Field:
_FILENAME
Regular expression:
%_FILENAME%
Replace matches with:
XXX
[X] case-sensitive comparison

```

Thanks.

---

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [February 1, 2010, 5:01pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/2 "2010-02-01T17:01:34Z")

</div>

QUOTE (chrisjj @ Feb 1 2010, 16:49) \<{POST\_SNAPBACK}\>

This Action has doesn't work. How should I adjust to get it to set the filename to XXX?

```
Replace with regular expression

Field:
_FILENAME
Regular expression:
%_FILENAME%
Replace matches with:
XXX
[X] case-sensitive comparison

```

Thanks.

Change  
"Regular expression:  
%\_FILENAME%"

TO

(.\*?)

It should work.  
"Replace with regular expression" finds blocks of characters of the given criteria, (.\*?) matches all characters possible in the given field - you cannot use the name of the field itself, although I see your logic.

---

<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 1, 2010, 5:09pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/3 "2010-02-01T17:09:26Z")

</div>

QUOTE (chrisjj @ Feb 1 2010, 17:49) \<{POST\_SNAPBACK}\>

This Action has doesn't work. How should I adjust to get it to set the filename to XXX?

```
Replace with regular expression

Field:
_FILENAME
Regular expression:
%_FILENAME%
Replace matches with:
XXX
[X] case-sensitive comparison

```

Thanks.

  
I think you have to enter .\* instead of %\_FILENAME% ...

But then again: as this is mainly a filesystem-function I would use either ...  
... the function tag - filename and simply enter xxx but no tag-fields  
.... or the dos-command-shell

ren \*.mp3 XXX.mp3

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [February 1, 2010, 5:18pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/4 "2010-02-01T17:18:32Z")

</div>

> [@Tarc](#):
>
> (.\*?)
> 
> It should work.

That gives a filename of XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX approximately!

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [February 1, 2010, 5:20pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/5 "2010-02-01T17:20:23Z")

</div>

> [@ohrenkino](#):
>
> I think you have to enter .\* instead of %\_FILENAME% ...

That fails too: it gives XXXXXX

> [@](#):
>
> But then again: as this is mainly a filesystem-function I would use either ...  
> ... the function tag - filename and simply enter xxx but no tag-fields  
> .... or the dos-command-shell

Thanks but that is what I'm trying to improve upon - I want the rename included in an existing Action group.

---

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [February 1, 2010, 5:25pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/6 "2010-02-01T17:25:03Z")

</div>

> [@chrisjj](#):
>
> That gives a filename of XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX approximately!

LOL.

I was sure that the brackets+? forces the search in a text to get the full field..  
Anyway I think you should use Format Value then.  
Set the format string to XXX and the field to \_FILENAME.  
This is the most straightforward solution I believe.

---

<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 1, 2010, 5:26pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/7 "2010-02-01T17:26:38Z")

</div>

> [@chrisjj](#):
>
> That fails too: it gives XXXXXX
> 
> Thanks but that is what I'm trying to improve upon - I want the rename included in an existing Action group.

have you tried the action "Format field" on the field \_filename and entered XXX for format string?

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [February 1, 2010, 5:51pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/8 "2010-02-01T17:51:56Z")

</div>

> [@ohrenkino](#):
>
> have you tried the action "Format field" on the field \_filename

That works thanks.

Still it would be nice to have the flexibility of regexp... if anyone can show how to get this simple case working.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [February 1, 2010, 5:53pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/9 "2010-02-01T17:53:56Z")

</div>

Thanks for the solutions people, but can anyone explain why my first attempt does not work.

---

<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 1, 2010, 5:57pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/10 "2010-02-01T17:57:32Z")

</div>

you cannot enter a field value variable in the find string. you have to use a regular expression like $if(%\_filename% = %\_filename%) which then becomes true to indicate that MP3tag should continue with the replace action.  
(Note: Probably I miss a 1 or comma in my reg-exp)

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [February 1, 2010, 6:24pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/11 "2010-02-01T18:24:32Z")

</div>

> [@ohrenkino](#):
>
> you have to use a regular expression like $if(%\_filename% = %\_filename%)

Um, that's not a valid regular expression.

Whereas my %\_FILENAME% is.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [February 1, 2010, 7:58pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/12 "2010-02-01T19:58:49Z")

</div>

> [@chrisjj](#):
>
> Whereas my %\_FILENAME% is.

Looks like an Mp3tag format string to me.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [February 1, 2010, 8:07pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/13 "2010-02-01T20:07:55Z")

</div>

> [@Florian](#):
>
> Looks like an Mp3tag format string to me.

It is that too. But are you implying it is not a valid regular expression???

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [February 1, 2010, 8:12pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/14 "2010-02-01T20:12:05Z")

</div>

It definitely is a valid regular expression -- only that it matches the string "%\_FILENAME%" only (which doesn't help you much).

Just tried to focus on the problem at hand.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [February 1, 2010, 8:22pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/15 "2010-02-01T20:22:11Z")

</div>

> [@Florian](#):
>
> It definitely is a valid regular expression -- only that it matches the string "%\_FILENAME%" only (which doesn't help you much).

Ah, so Mp3tag does not treat it as a placeholder.

Home come? Given the Help says scripting functions (presumably including placeholders) are allowed in this Action type.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [February 1, 2010, 8:59pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/16 "2010-02-01T20:59:32Z")

</div>

> [@chrisjj](#):
>
> Ah, so Mp3tag does not treat it as a placeholder.

Yes, placeholders and scripting functions are not evaluated in the regular expression field.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [February 1, 2010, 9:10pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/17 "2010-02-01T21:10:09Z")

</div>

> [@Florian](#):
>
> Yes, placeholders and scripting functions are not evaluated in the regular expression field.

Well, this suggests they are

[https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)  
The scripting functions are available at these parts of Mp3tag:  
Action, Replace with regular expressions

and I saw nothing to suggest they are not.

I think the Help and program should be made to accord.

Thanks Florian for the explanation.

---

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [February 1, 2010, 9:12pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/18 "2010-02-01T21:12:24Z")

</div>

> [@chrisjj](#):
>
> Well, this suggests they are
> 
> [https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)  
> The scripting functions are available at these parts of Mp3tag:  
> Action, Replace with regular expressions
> 
> and I saw nothing to suggest they are not.
> 
> I think the Help and program should be made to accord.
> 
> Thanks Florian for the explanation.

The help topics are not too detailed anyway. could do with an update/rework, starting from sketch rewriting things so more things are clear and covered

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [February 1, 2010, 9:28pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/19 "2010-02-01T21:28:24Z")

</div>

Agreed, but detail is one thing. Accuracy is another... worth addressing now, I suggest! 🙂

---

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [February 1, 2010, 9:39pm UTC](https://community.mp3tag.de/t/replace-with-regexp-filename/9811/20 "2010-02-01T21:39:36Z")

</div>

Well, true. The (relatively) small amount of info contains stuff like you jsut described. i THOUGHT %\_FILENAME% would not work but was just intuition, had not learnt anywhere from the Help or anything.

[Next page](https://community.mp3tag.de/t/replace-with-regexp-filename/9811.md?page=2)
