Replace certain special characters with emtpy space

“Hi everyone, I have a large text from which I need to remove the sequences “???!!! and !!!???” However, I don’t want to remove all special characters, just these two specific combinations. I’ve been trying to use the Replace function, but I can’t because of the quotation marks.”

“price”:“”,“tooltipContent”:“”}],“description”:“”,“maxLength”:“”,“placeholder”:“”,“cssClass”:“”,“defaultValue”:“”,“conditionalLogic”:“”,“layoutGridColumnSpan”:“???!!!12???!!!”,“enableEnhancedUI”:“???!!!0???!!!”,“calculationFormula”:“”,“tooltipContent”:“”,“imageChoices_enableImages”:“0”},

Desired result:
“price”:“”,“tooltipContent”:“”}],“description”:“”,“maxLength”:“”,“placeholder”:“”,“cssClass”:“”,“defaultValue”:“”,“conditionalLogic”:“”,“layoutGridColumnSpan”:12,“enableEnhancedUI”:0,“calculationFormula”:“”,“tooltipContent”:“”,“imageChoices_enableImages”:“0”},

Thanks!

@Slavi

please use replace like this str.Replace("""???!!!","").Replace("???!!!""","")

cheers

give a try at

strPattern = "(""\?\?\?!!!|\?\?\?!!!"")"

strCleansed =
System.Text.Regularexpressions.Regex.Replace(YourTextVar, strPattern, "")

Hi @Slavi

Assign cleanedText = System.Text.RegularExpressions.Regex.Replace(yourInputText, "\?*\!*", "")

Hi there, unfortunately it is not really working out. Here is the error message:

@Slavi
Just now Modified,Sorry for mistake

it is about the ? which we would ecape with \ within the pattern as shown here

I am getting the same error message as in previous post:

no worries, but I am not really sure what should I do with Just now Modifier?

@Slavi
Check with this

Assign cleanedText = System.Text.RegularExpressions.Regex.Replace(yourInputText, "\?*\!*", "")

we crosschecked within immediate panel (kindly note a " is visualized by ")

and as shown above it was working

this one works well :wink: thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.