Simple IF script doesn't seem to work

I am trying to format title field with file modified date using following IF script $if($right(%title%,1)=},%title%%_file_mod_date%,%title%):

:arrow_forward: i.e. if the title ends with a right brace "}" character, add file modified date to end of the title, else leave it as it is:
:arrow_forward: However it always appends the date. I tried enclosing the brace character in the test condition in single or double quotes "}" or '}' but it seems to have no effect. Looks like I don't know scripts at all.

Please help what am I doing wrong?

Have a look at the help about scripting function
Should look like

Thank you so much Ohrenkino for your help.