Hi
Please use the below expression.
Here we are trying to replace # if any. (doesnt check if they are in leading or trailing position) and countrycode if it is equal to the country_code column.
iif(instr(original_desc_txt,country_code)>0, replace(replace(original_desc_txt,'#',''),country_code,''),original_desc_txt)
Please see below. In the second column, we see the original text before replacement. In the third column we see country code. if the second column has the country code as in third column, it will be replaced by empty string. Else the country code will be left as such along with #
Please let us know if you need any clarification