Trim all tags using Format Values

Using this method: Actions

You have to create 2 Regex actions to trim Front and End whitespaces.

I want to do trimming with Format Values:

  • Field: _TAG
  • Format string: $trim(%_tag%)
1 Like

Further down that thread it also mentions the $trim() function that deletes leading and trailing spaces.
Have you tried it?
Although it could well be that $trim() looks at a whole field and then _TAG is the complete string of all fields so that only the first and the last space are deleted.
You would have to name the fields individually.

Action "Replace using Regular Expression"
Field: _TAG
RegExp: ^\s*|\s*$
Replace with:

DD.20170304.2040.CET

I just found a gotcha on this trim action that I have been using for years!

If you have a field with blank lines i.e. 2 consecutive CRLF e.g. a lyrics field with line spacing between verses, then this action will delete them because \s*$ will match 2 CRLF.

You can use ^\h+|\h+$ instead. \h matches horizontal whitespace but not CRLF