Removing Invalid Characters for File Name
Good Afternoon,
I am trying to manipulate a simple text field to remove the following characters:
\ / : * ? " < > |
So that I can use it for file names.
When I try SearchandReplace, it keeps throwing up syntax errors for these characters despite my double quotes around them. Is there a way to get these characters removed to prevent any file upload issues due to file name?
Thank you for the help!
Here is Chat GPT's second response to your question. I have not tested it myelf so please post back and let us know if it worked OK.
Yes, you can use RegexReplace() in Quickbase for a cleaner and more efficient solution than nesting multiple Substitute() calls.
✅ Formula using
RegexReplace()
If your field is [Original Text], here’s the expression:
RegexReplace([Original Text], "[\\\\/:*?\"<>|]", "")
💡 Explanation:
- RegexReplace(text, pattern, replacement) replaces all matches of the regular expression pattern in the text with the replacement.
- The regex pattern [\\\\/:*?\"<>|] matches any one of the listed characters.
- The double backslash \\\\ is needed because:
- In regex, \ is an escape character.
- In Quickbase strings, you must escape backslashes again — so you need four (\\\\) to represent one literal \.
Characters being removed:
\ / : * ? " < > |