Skip to main content

Hello. As the title states I am looking for a way to replace multiple characters that may be found within the “Input text” field of Formatter/Replace. The reason for this is we are attempting to pass along a new Teams channel name to Microsoft Graph and there are known characters that don’t play nice.

~#%&*{}+/\:<>?|‘”

I am able to test with only one of these characters in the “Find” field and achieve removing that characters, but how do I include several(all of them would be ideal) from a single step?

Many thanks for any assistance.

Hi @dshaines 

Good question.

Some options:

  1. Ask AI
    1. ChatGPT
    2. OpenAI
  2. Code
    1. JavaScript
      1. Help for .replace() method
    2. Python

Hey @dshaines ,

Here is a Python code step that should work for you:

import re

output = {'output_string': re.sub(re.compile(""~#%&\*\{\}\+/\\:<>\?\|‘”]+"), ' ', inputi'input_string'])}]

 

That will work if you have your input set up like so:

 

Does that help? Let me know if you have any more questions