My need is fairly simple.
I want to apply this regex action to TITLE and ALBUM (for now) without duplicating and maintaining two (or more) identical actions.
While searching for similar topics and solutions, I came across a few that target similar needs.
In 2006, the solution was to apply an action globally to _TAG after exporting the tags that should not be touched and then to reimport those tags afterwards to restore them.
In 2011 the question remained unanswered, but I like the proposal to add a self placeholder to refer to each of the multiple delimited source fields.
In 2017, @ohrenkino provided the interesting idea to use a Guess Value action to achieve this goal.
While it worked for the simple $replace action example, I had no success getting my regular expression action to work in this way.
The first pitfall is having to further escape [] within the already fairly cryptic regular expression, turning:
(?<![-.:!?\]] )(?<= )(A|An|The|And|But|Or|As|At|By|For|In|Of|On|To)(?= )
into:
(?<!'['-.:!?\']'']' )(?<= )(A|An|The|And|But|Or|As|At|By|For|In|Of|On|To)(?= )
However even with this working regex, the $lower() function does not appear to be working in this context (or I also have to escape this and don't know how).
I tested the regexp function in a Tag - Tag Converter:
$regexp(%album%,(?<!'['-.:!?\']'']' )(?<= )(A|An|The|And|But|Or|As|At|By|For|In|Of|On|To)(?= ),$lower($1))
Live at the Bajal Festival would be the expected result.The regex matches successfully, however $lower() is not applied to the matches.
Surrounding the matches with
x shows the successful match and replacement:Using the same approach in a Guess Value action (following ohrenkino's approach) also did not yield the expected result.
Adding ,0 to the $regexp to disable the ignore case setting also had no effect.
In 2023 the workaround from 2017 was suggested and accepted.
I personally would prefer the suggested feature to refer to multiple, delimited fields by a self placeholder from the 2011 post, since it does not necessitate further escaping and a (hopefully unique) delimiter like the workaround provided by ohrenkino and would overall be the most straightforward and simple to use.
However in the meantime I'd be interested to learn how I can escape $lower() to make it work in the Guess Value workaround.





