Skip to main content

Hello,

How can I replace all special characters in a workflow? Say you get a string from a SharePoint list: (MyString#1-a). So, I want to remove all special characters from that string: ()#- and I want to replace them with an HTML code for each symbol. So my final string would be: %2528MyString%25231%252Da%2529

where...

%2528 is the parentheses

MyString

%2523 is the #

1

%252D is the -

a

 %2529 is the closing parentheses

Note, I have all the html encoding reference for special characters.

Have you seen the fn-Replace function?


What you show in your example are not HTML symobls, in fact (MyString#1-a) can be safely used within HTML. You probably need URL-Encoding. Even for the use in an URL, you would only need to replace the # in your example, the other special characters ()- can be used in an url.

Depending on your needs and the possible inputs, assuming you want to create a valid url, you can use a couple of fn-Replace calls (e.g. use some "Build String" Actions) to replace any reserved or unsafe characters like #, /, ., :, &, ?, =, %, blanks etc. Unfortunately there is, as far as i know, no built-in URL-Encoding function in Nintex (while there ist fn-XmlEncode, which creates valid HTML, but is not of help in your case).


Thank you Fernando, I have studied the fn-Replace function and it has worked for my issue.

Kind Regards,

Ricardo


Thank you didosa, the fn-Replace function did the trick. I had to use a lot of {textStrart} {textEnd} tags and I had to cut the concatenation in 3 parts (buildStrings) for it to work. Thanks again!

Kind Regards,

Ricardo


Don't forget to mark an answer as correct to close this question.


Reply