Actions and batch-operations

How to remove/trim leading and trailing spaces

Video tutorial for these actions

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)

6 Likes