# Actions and batch-operations

**URL:** https://community.mp3tag.de/t/actions-and-batch-operations/967
**Category:** FAQ (Frequently Asked Questions)
**Created:** [April 16, 2004, 7:46am UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967 "2004-04-16T07:46:06Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 3:53pm UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/10 "2004-04-16T15:53:04Z")

</div>

### How to remove/trim leading and trailing spaces

**[Video tutorial for these actions](http://www.vimeo.com/7756545)**

#### Leading spaces:

Action type: Replace with regular expressions  
Field: **\_TAG**  
Regular expression: **`^\s+`**  
Replace matches with:

**`^`** matches the beginning of the string. Then **`\s+`** searches for all whitespaces till a different char occurs.  
The whitespaces found will be replaced by nothing and, thus, deleted.

#### Trailing spaces:

Action type: Replace with regular expressions  
Field: **\_TAG**  
Regular expression: **`\s+$`**  
Replace matches with:

This regular expression matches one and more (marked by **`+`** ) spaces (marked by the **`\s`** specifier) at the end (marked by **`$`** ) of a string.

#### Trailing spaces from filenames:

An action that doesn't remove the file extension:

Action type: Format value  
Field: **\_FILENAME**  
Formatstring: **`$trim(%_filename%)`**

#### Cut two or more consecutive spaces to one:

Action type: Replace with regular expressions  
Field: **\_ALL**  
Regular expression: **`\s{2,}`**  
Replace matches with: " " (without the quotes)

---

_[View the full topic](https://community.mp3tag.de/t/actions-and-batch-operations/967)._
