In Mp3tag the single apostrophe has the special meaning to be the string delimiter character.
If you need the single apostrohe in a string as a literal character, it must be written twice (see Mp3tag manual).
Thanks for the prompt response but your suggestions do not work with the FORMAT statement.
I've tried the following:
FORMAT title $regexp(%title%,'a''''c',abc)
FORMAT title $regexp(%title%,'a''c',abc)
FORMAT title $regexp(%title%,''a'c'',abc)
FORMAT title $regexp(%title%,'''a'c''',abc)
FORMAT title $regexp(%title%,''a''c'',abc)
FORMAT title $regexp(%title%,'''a''c''',abc)
FORMAT title $regexp(%title%,''a'''c'',abc)
FORMAT title $regexp(%title%,'''a'''c''',abc)
FORMAT title $regexp(%title%,''a''''c'',abc)
FORMAT title $regexp(%title%,'''a''''c''',abc)
Isn't it easiest that if you replace one string constant (here: apostrophe) with another string constant (here: to use a simple "replace" action?
Where is the advantage of the "format" action?
'a''''c' same as >a'c<
''a'c'' syntax error, because of odd number of apostrophes
'''a'c''' syntax error, because of odd number of apostrophes
''a''c'' same as: >'a'c'<
'''a''c''' same as: >'ac'<
''a'''c'' syntax error, because of odd number of apostrophes
'''a'''c''' syntax error, because of odd number of apostrophes
''a''''c'' same as: >'a''c'<
'''a''''c''' same as: >'a'c'<
Your examples do not require the function $regexp(), why do you use it?
Using the action "Tag-Tag" you can test a formatstring, the preview displays the result instantly.
I use FORMAT TITLE for the following:
$if($stricmp(%album%,Notebook on Cities and Culture),$regexp(%title%,'^S\d+E\d+: Notebook on Cities and Culture.s Korea Tour:','Korea Tour.'),%title%)
S4E24: Notebook on Cities and Culture's Korea Tour: Eating It All Together with Daniel Gray -->
Korea Tour. Eating It All Together
The idea would be to replace the period (.) with a single apostrophe (') in Culture.s
This is just one example of where I use FORMAT TITLE instead of a plain REPLACE or REPLACE WITH expression
So you use an action "Format value" to set the tag-field TITLE using this formatstring ...
TITLE <==$if(
<!--coloro:#800080--><span style="color:#800080"><!--/coloro-->$stricmp<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->(<!--colorc--></span><!--/colorc--><!--coloro:#0000a0--><span style="color:#0000a0"><!--/coloro-->%ALBUM%<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->,<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->Notebook on Cities and Culture<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->)<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->,<!--colorc--></span><!--/colorc-->
<!--coloro:#800080--><span style="color:#800080"><!--/coloro-->$regexp<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->(<!--colorc--></span><!--/colorc--><!--coloro:#0000a0--><span style="color:#0000a0"><!--/coloro-->%TITLE%<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->,<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->^S\d+E\d+: Notebook on Cities and Culture.s Korea Tour:<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->,<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->Korea Tour.<!--colorc--></span><!--/colorc--><!--coloro:#008080--><span style="color:#008080"><!--/coloro-->'<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->)<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->,<!--colorc--></span><!--/colorc-->
<!--coloro:#0000a0--><span style="color:#0000a0"><!--/coloro-->%TITLE%<!--colorc--></span><!--/colorc--><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->)<!--colorc--></span><!--/colorc--></b><!--fontc--></span><!--/fontc--><!--sizec--></span><!--/sizec-->
So you apply the function $regexp here to handle prefixes like '^S\d+E\d+' in the tag-field TITLE.
If the regexp matches the rule, then you replace the existing value with the text 'Korea Tour.', ...
otherwise the tag-field TITLE is used as is.
If you are unsure whether the word "Cultures" or "Culture.s" or "Culture's" does exist, ...
then you can use a placeholder and wildcard symbol, as allowed for a regular expression.
$regexp(%TITLE%,'^S\d+E\d+: Notebook on Cities and Culture.+?s Korea Tour:','Korea Tour.'),... or ...$regexp(%TITLE%,'^S\d+E\d+: Notebook on Cities and Culture.*s Korea Tour:','Korea Tour.'),
Note: In the Regexp language the dot means any character.
Because you have already used the one dot character as the placeholder for one unknown character, ...
then the function $regexp replaces the entire given string on match for all spellings of "Culture.s" ...
with the text "Korea Tour.".
Anyway ... I got the impression, that you do not understand what you are doing there ...
... or is it me?
So here is a proposal to replace the dot character with an apostrophe, within the word "Culture.s".
TAGFIELD <==$replace(%TAGFIELD%,'Culture.s','Culture''''s')... or ...TAGFIELD <==$replace(%TAGFIELD%,'Culture.s','Culture'$char(39)'s')... or ... replace all dots ... TAGFIELD <==$replace(%TAGFIELD%,'.',$char(39))... or ...TAGFIELD <==$replace(%TAGFIELD%,'.','')
yes obviously we have a failure to communicate. i go back to my original post ... i want to escape a single apostrophe within a FORMAT statement that uses a literalized expression.
so FORMAT TITLE $if($eql(%album%,'statement containing a single apostrophe'),'results',%title%) is another example.
I use FORMAT containing literalized expressions quite often and in a variety of ways and it would be nice to be able to include statements containing single apostrophes (i.e., it would be nice to escape single apostrophes).