Solved

Strip Special Characters from entered value

  • 21 September 2022
  • 4 replies
  • 952 views

Badge +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

 

 

icon

Best answer by Garrett 21 September 2022, 15:15

View original

4 replies

Userlevel 6
Badge +16

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


 

Badge +4

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.

Userlevel 6
Badge +16

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.



 


 

Badge +4

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


 


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

Reply