Skip to main content
Nintex Community Menu Bar
Solved

Strip Special Characters from entered value

  • September 21, 2022
  • 4 replies
  • 1617 views

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.

 

 

4 replies

Garrett
Forum|alt.badge.img+16
  • Scout
  • September 21, 2022

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 "_"

 


Forum|alt.badge.img+4
  • Author
  • Rookie
  • September 21, 2022

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.


Garrett
Forum|alt.badge.img+16
  • Scout
  • Answer
  • September 21, 2022

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.

 

 


Forum|alt.badge.img+4
  • Author
  • Rookie
  • September 27, 2022

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

 

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