Skip to main content
Nintex Community Menu Bar

Is there a simple way to strip all special characters from a string?

  • June 22, 2017
  • 4 replies
  • 137 views

Forum|alt.badge.img+3

For purposes of building a URL for a link, I am stripping special characters like comma, period and question mark from a string (created by a user entry):

fn-Replace({TextStart}{ItemProperty:Title}{TextEnd},{textstart},{textend},)

This is working great, but I'm wondering if there is some operator that I can use to refer to all special characters, or if there is an entirely different approach that would deliver the desired result.

Ideas?

4 replies

Forum|alt.badge.img+14
  • Scholar
  • June 25, 2017

imho, better option would be to use regular expression.

where do you do it, in forms or workflow?


Forum|alt.badge.img+9
  • June 26, 2017

Marian is right. Here is an example using a character class in regex replacing all characters not in class by empty string.

^ Match a single character not present in the list below
[^w]
w matches any word character (equal to [a-zA-Z0-9_])
in place of w You can use a list of all allowed characters.

204941_pastedImage_1.png


Forum|alt.badge.img
  • Nintex Partner
  • April 10, 2019

Great...How about if i want to keep only "/"


Forum|alt.badge.img+9
  • April 10, 2019

as w matches any letter, digit or underscore which is equivalent to [a-zA-Z0-9_] You can use

[^a-zA-Z0-9_/]