Skip to main content
Nintex Community Menu Bar
Solved

Strip Special Characters from entered value

  • Sep 21, 2022 12:35 PM UTC
  • 4 replies
  • 1773 views
  • Translate All

Forum|alt.badge.img+4

I have a NWC Form which allows the user to attach a file which I then upload to a SharePoint online library.  In the upload action, I created a folder using the Firm Name which is entered on the form.  I have run into an issue when someone enters special characters in the Firm Name as SharePoint don't allow special characters in the naming of folders.  

 

I've tried using Apply a regular expression action but I'm really bad at regex.  I've been able to get there somewhat by use the Replace operation with expression [^w] and using an underscore character to replace. But what I really want to do is remove the special character entirely but the Replace text field cannot be left blank.

 

Help!

 

26431i9EE4127CD4DF6ADF.png

 

 

Best answer by Garrett

Use this. It will replace with an empty char (essentially removing any invalid chars)

replace([Form].[FileName],"[^a-zA-Z0-9- ]","")

 

The previous (below) will replace with underscore.

 

 

View original

4 replies

Garrett
Forum|alt.badge.img+16
  • Scout
  • Sep 21, 2022 12:57 PM UTC

Hi @tmfitz 

 

Refer this article

https://community.nintex.com/t5/Responsive-Forms/Filename-entry-in-Responsive-forms/td-p/221644 

 

This reads as Replace (Not Capital A-Z)(not Smallcaps a-z)(Not 0-9)(Not -space- char) with underscore "_"

 

Translate

Forum|alt.badge.img+4
  • Author
  • Rookie
  • Sep 21, 2022 1:07 PM UTC

Thanks @Garrett.  I was able to achieve that on my own. What I really want to do is remove the special characters from the Firm Name. Sorry if I wasn't clear.

Translate

Garrett
Forum|alt.badge.img+16
  • Scout
  • Answer
  • Sep 21, 2022 1:15 PM UTC

Use this. It will replace with an empty char (essentially removing any invalid chars)

replace([Form].[FileName],"[^a-zA-Z0-9- ]","")

 

The previous (below) will replace with underscore.

 

 

Translate

Forum|alt.badge.img+4
  • Author
  • Rookie
  • Sep 27, 2022 12:56 PM UTC

Thanks. That worked. This is the function I ended up using - 

 

replace([Form].[Firm Name],"[^a-zA-Z0-9- ]","")

Translate