Skip to main content
Nintex Community Menu Bar

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

  • Jun 22, 2017 3:41 PM UTC
  • 4 replies
  • 153 views
  • Translate All

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
  • Jun 25, 2017 2:26 PM UTC

imho, better option would be to use regular expression.

where do you do it, in forms or workflow?

Translate

Forum|alt.badge.img+9
  • Jun 26, 2017 8:32 AM UTC

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

Translate

Forum|alt.badge.img
  • Nintex Partner
  • Apr 10, 2019 10:38 AM UTC

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

Translate

Forum|alt.badge.img+9
  • Apr 10, 2019 10:50 AM UTC

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

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

Translate