Remove special characters from file name

Hi all. I am looking for a way to remove special characters from a text string. I would like to use a file name input and then remove ~ " # % & * : < > ? / \ { | }. if they exist in the file name and return the text without those characters.

I’m trying to use the Text Parser - Replace but can’t seem to figure out what my search and replace should be.

Here is an example file name - “Apnea records Part #2
I’d like to have that get replaced with “Apnea records Part 2” (no #)

What goes in pattern and what goes in value. Or should I be using some type of formula?

Have you read about regular expressions?

1 Like

Yes. I just can’t quite seem to figure out what my pattern and replace should be. I’ve tried several different combinations. I can write a regex to match on the characters I want to remove but not sure how to remove them and then reassemble the string back minus the special characters.

Hi @cah23

You can use replace() function to solve your issue.



Msquare Support
Automation Expert

3 Likes

Thanks. This worked.

1 Like