cancel
Showing results for 
Search instead for 
Did you mean: 

How to Remove a Claims token using a Regular Expression

sumit_jethwa
Nintex Newbie
5 3 6,502

I thought this would be helpful to share with other Nintex Users,

The original question that I was asked was how to remove the Claims token prefix before a username.

The solution is pretty simple, you can use the "Regular Expression" action within a Nintex Workflow and look for the pattern:

i\:0\#\.w\|

This will effectively remove the token, leaving you with just the domain\username.

3 Comments
DrewA
Nintex Newbie

This is exactly what I was looking for, Sumit Jethwa! I'm not very familiar with the Regular Expression action, so I had to tinker with it a bit. Here is some beginning user detail...


For 'noobs' like me who want only the domain ID to remain and stored as a variable but not the domain itself, nor the backslash following it, this is an example of the pattern I used:

i\:0\#\.w\|us\\

where "us" is the domain (replace it with whatever your domain is). Note the second to last backslash which escapes the last backslash so as not be viewed as a special character (that, of course, is what all the previous backslash are doing with  their following special characters).  In the Regular Expression dialog box, then, you use the 'Replace' radio button, leaving the Replacement Text field empty (the 'special sauce'  to ensure you are simply removing the regular text, keeping only the unique). This removed all text preceding the actual domain ID which is what I was looking for.

In my example below, I just replaced the input variable content with the output of the regular expression. You may want to use two different variables if you need to maintain a distinction between your input into the regular expression and the output. I did not need to do that.

Regular Expression panel to obtain ONLY the name of the domain ID

Why did I not want the domain name and backslash? This datum is to be exported to an external application's database in which the domain name, in my case, "us\" is already understood/implicit.  Thanks again!

shannis
Nintex Newbie
I used nested UserProfilelookup in Calculated value on Nintex form for Supervisor's manager we needed.
userProfileLookup(replace(userProfileLookup(userProfileLookup(userProfileLookup(SubmitterName, "Manager"), "Manager"), "Manager"), "i:0#.f\\|membership\\|", ""), "PreferredName")
shannis
Nintex Newbie
For manager:
userProfileLookup(replace(userProfileLookup(SubmitterName, "Manager"), "i:0#.f\\|membership\\|", ""), "PreferredName")