Literalized Expression Containing a Single Apostrophe

In an ACTION FORMAT Title expression I want to replace a single apostrophe.
a'c -> abc

As a temporary fix I use FORMAT TITLE $regexp(%title%,'a.c',abc) but would prefer to directly search for the single apostrophe.

This is obviously a simplified example ... I do need to literalize the match.

Thanks

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).

From "a'c" to "abc" ...

$replace('a''''c','','b')

... or...

$replace(a''c,'',b)

...or ...

$regexp('a''''c','a\x27c','abc')

... or...

$regexp('a''''c','\x27','b')

.. or ...

$replace('a''''c',$char(39),'b')

DD.20150129.1658.CET

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)

Obviously I must have too much time on my hands.

Any other suggestions?
Keith

Isn't it easiest that if you replace one string constant (here: apostrophe) with another string constant (here: :sunglasses: to use a simple "replace" action?
Where is the advantage of the "format" action?

'a''c' same as >ac<

'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.

DD.20150130.0928.CET

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

Thanks

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%,'.','')

DD.20150201.1658.CET

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).

Rgds

Read Mp3tag manual ...
if you want to display one apostrophe, then you have to write two apostrophes.

'statement containing a ==>''''<== single apostrophe' |---part1------------------| |----part3------------|
                        <!--coloro:#000000--><span style="color:#000000"><!--/coloro-->==<!--colorc--></span><!--/colorc-->
                     <!--coloro:#000000--><span style="color:#000000"><!--/coloro-->apostrophe<!--colorc--></span><!--/colorc--></b><!--fontc--></span><!--/fontc--><!--sizec--></span><!--/sizec-->

... or ...

'statement containing a ==>'$char(39)'<== single apostrophe' |---part1------------------| |----part3------------|
                        <!--coloro:#000000--><span style="color:#000000"><!--/coloro-->=========<!--colorc--></span><!--/colorc-->
                       <!--coloro:#000000--><span style="color:#000000"><!--/coloro-->apostrophe<!--colorc--></span><!--/colorc--></b><!--fontc--></span><!--/fontc--><!--sizec--></span><!--/sizec-->

Verify the Formatstring in the action [Alt+5] "Tag-Tag", the preview displays the result.

DD.20150202.1808.CET

To be nitpicking ...
... the text string 'statement containing a single apostrophe'
... does not contain a single apostrophe!

DD.20150202.1842.CET

Here is an action group to simulate the process ...

Begin Action Group Test2015#20150202.rko31415.Replace.Apostrophe

Action #1
Actiontype 5: Format value
Field ______: TEST
Formatstring: 'statement containing a ==>''''<== single apostrophe'

Action #2
Actiontype 5: Format value
Field ______: TEST_ESCAPED
Formatstring: 'escaped: '$replace(%TEST%,'','''')

End Action Group Test2015#20150202.rko31415.Replace.Apostrophe (2 Actions)

DD.20150202.1830.CET