I made a mistake in running a substitution on some images and came across a problem in trying to fix it. After I ran the command, the substitution part was appended to tag. An example end result where I tried to replace a persons name looks like this:
Headline : Person1 at the hotel;s/Person1/Person2/i}
The error came with trying to remove the end brace }. I try the following command
exiftool "-Headline<${Headline;s(;s/Person1/Person2/i\})()}" <file>
And get the following output
Warning: Substitution pattern not terminated for Headline - <file>
And the tag now looks like this
Headline : Person1 at the hotel;s/Person1/Person2/i})()
After some more testing, I find I can remove most of the error using "-Headline<${Headline;s(;s/Person1/Person2/i)()}" but any attempt to do a substitution on the end brace just appends more stuff to the end of the tag.
In the end, I was able to work around the problem by using the dot wildcard to do the replacement. This was version 9.22
tl;dr: Unable to do a substitution on the end brace character in a tag.
From the documentation:
An advanced formatting feature allows an arbitrary Perl expression
to be applied to the value of any tag by placing it inside the
braces after a semicolon following the tag name. The expression
has access to the value of this tag through the default input
variable ($_), and the full API through the current ExifTool
object ($self). It may contain any valid Perl code, including
translation ("tr///") and substitution ("s///") operations.
Braces within the expression must be balanced. The example below
prints the camera Make with spaces translated to underlines, and
multiple consecutive underlines replaced by a single underline:
Unfortunately I couldn't think of a simple way around this.
- Phil
My mistake then. I actually haven't read the documentation since I got the hang of the program, following the forums instead to keep track of how things get changed :D.