Remove trailing apostrophe

How can we do the same thing but with a single trailing apostrophe?

So Cryin' becomes Cryin

I've tried a few variations but it seems to ignore my wishes. I'm obviously guessing wrong.

Turns out you need to use ASCII codes and a line break....
The following removes ONLY ALL trailing apostrophes at the end the string, so you will lose your '' if you have a double apostrophe to indicate 7 inch or 12 inch at the end of your TITLE. (i.e 7'' or 12'' - where '' is a double apostrophe (char(39) and not a double quote (char(34) will remove both apostrophes)

[#187]
T=5
1=$trimRight(%TITLE%,$char(39)$char(10))
F=TITLE

I am not convinced that a $char(10) can always be found in a string.

If you want to get rid or really only the apostrophes at the end of the TITLE, try an action of the type "Format value" or Convert>Tag-Tag for TITLE and
Format string: $regexp(%title%,''$,)

The double apostrophe in the expression escapes the apostrophe which otherwise has a special function in the regular expression.

If, on the other hand you only want to remove the trailing apostrophes in the text but keep the ones at the end of a field, try:
Format string: $regexp(%title%,''\s+,)

1 Like

The only way I have found is to use several single steps.
Something like
replace the 2 single apostrophes '' as inches indicator with a rare used character like § or °
and - after the next unsolved step - "undo" it and replace the rare character back to 2 single apostrophes.

The unsolved step is this:
How to replace the remaining single apostrophes with nothing = delete them?
Because here we have a problem:
How do you distinguish between an single UNWANTED apostrophe in
So Cryin' becomes Cryin
and a WANTED single apostrophe in
So O'Reilly remains O'Reilly
Maybe if you try to replace only a single apostrophe followed by a space?
This will not work for a single apostrophe at the end of line like in
So at the end you have still Cryin'
This also not works for (theoretically existing) apostrophes at the start of a word or at start of the line like
'nuff said and the Klingon's still think there are 's

Currently, I don't see a reliable way to achieve a solution for most of the occurences.

Any other ideas?

With my expression/s above, it does not remove apostrophes in the middle of words, so O'Reilly is safe. I tested it and it doesn't usually remove any at all in the middle, unless I think there was a thing where
Cryin' (Remix) ==> Cryin (Remix) but that could have been from other code I have in the same Action/

But otherwise the one's in the middle of the string survived

If my code becomes an issue, I shall try this. Thanks