# Renaming files with tag, replace trailing periods

**URL:** https://community.mp3tag.de/t/renaming-files-with-tag-replace-trailing-periods/12740
**Category:** Support
**Created:** [November 26, 2011, 2:58pm UTC](https://community.mp3tag.de/t/renaming-files-with-tag-replace-trailing-periods/12740 "2011-11-26T14:58:44Z")
**Posts on this page:** 1
**Showing post:** 6

<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: [November 26, 2011, 4:48pm UTC](https://community.mp3tag.de/t/renaming-files-with-tag-replace-trailing-periods/12740/6 "2011-11-26T16:48:58Z")

</div>

> [@Cheese Turtle](#):
>
> ... $if($neql(%albumartist%,"") ...

What is the correct meaning of this code fragment?  
If placeholder is empty ... or ... if placeholder contains two double apostrophes?

If you need to test for the existence of any content in a placeholder, then you can code ...  
$if(%placeholder%,'yes','no')

If the first meaning is that what you want to do, then you can shorten the format string to ...

**$validate('E:\Music\'$regexp($if2(%ALBUMARTIST%,%ARTIST%),'\.+$','\_')'\'$regexp(%ALBUM%,'\.+$','\_')'\'$num(%TRACK%,2)' '%TITLE%,'\_')**

... or even better ... see following examples ...

* * *

**Examples for "Clean Path String"**

**1.**

**$validate($regexp('x ... E: \ ... Music \ ...\ ... Artist \*2\*\ Title 3 ... x','(?:^|(?\<=\\\\))[.]+|[.]+(?:(?=\\\\)|$)',),'\_')**

Result = "x ... E\_\Music\_Album 1\_\Artist _2_\Title 3 ... x"

**2.**

**$validate($regexp(' ... E: \ ... Music \ ...\ ... Artist \*2\*\ Title 3 ... ','(?:^|(?\<=\\\\))[.]+|[.]+(?:(?=\\\\)|$)',),'\_')**

Result = "E:\Music\_Album 1\_\Artist _2_\Title 3"  
Note: $validate respects the colon at the second string position.

**3.**

**$validate($regexp(' ... E: \ ... Music \ ...\ ... Artist \*2\*\ Title 3 ... ','(?:^|(?\<=\\\\))[.]+|[.]+(?:(?=\\\\)|$)',),)**

Result = "E:\Music\Album 1\Artist 2\Title 3"  
Note: $validate respects the colon at the second string position.

**4.**  
This expression might be the safest one to remove all bad characters from the given string ...

**$regexp($validate($regexp(' ... E: \ ... Music \ ...\ :.:.: ... | Artist \*2\*\ ? Title 3 ... ','(?:^|(?\<=\\\\))[.]+|[.]+(?:(?=\\\\)|$)',),),'(?:^|(?\<=\\\\))[.]+|[.]+(?:(?=\\\\)|$)',)**

Result = "E:\Music\Album 1\Artist 2\Title 3"  
Note: $validate respects the colon at the second string position.

* * *

DD.20111126.1905.CET  
Edit.  
DD.20111128.0955.CET

---

_[View the full topic](https://community.mp3tag.de/t/renaming-files-with-tag-replace-trailing-periods/12740)._
