cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Nintex Newbie

Using a Regular Expression to Delete Characters in a Collection Variable

Hi 

 

I am trying to use a regular expression to delete the characters between to two items in a collection variable. In this case  - and ;. 

 

For example, 

 

Smith, John - OrgName-SubOrg, St. Louis, MO; Cook, David - OrgName-SubOrg, Washington, DC; to be 

Smith, John; Cook, David 

 

I used  (?<=-).+(?= ; ) 

 

got this: 

 

Smith, John - ; 

 

Any help would be appreciated. 

Labels: (1)
0 Kudos
Reply
9 Replies
Highlighted
Automation Master
Automation Master

Re: Using a Regular Expression to Delete Characters in a Collection Variable

@mrdavidcook .....what's the source of your collection value? I mean how you're getting the values  in  your collection?

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Using a Regular Expression to Delete Characters in a Collection Variable

Great question @ kunalpatel. I'm using query user profiles. 

0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: Using a Regular Expression to Delete Characters in a Collection Variable

@mrdavidcook .....If you just need the name then you can use Name, FirstName, LastName attribute. Which attribute you're pulling here?

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Using a Regular Expression to Delete Characters in a Collection Variable

Thanks, @kunalpatel but first name gives me David Tom Smith Jones because its a collection variable. I am using a collection variable to collect multiple names.

and Name give me Tom Smith - Org Unit - Suborg Unit - Location. I am trying to delete all of that stuff after Tom Smith in a collection so would get David Smith; Tom Jones.

I am using First and Last Name in fields that are not collection variables.
0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: Using a Regular Expression to Delete Characters in a Collection Variable

@mrdavidcook ....can you please share how you're storing the values in the collection? If it's collection then your value should be separated by ";".

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Using a Regular Expression to Delete Characters in a Collection Variable

@kunalpatel , Smith, Tom, Saint Louis MO;Bryson, Bill, Washington, DC; So we are using a ';'.

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Using a Regular Expression to Delete Characters in a Collection Variable

@kunalpatel , I got ( - )(.+)(\;) as a regular expression and this deleted everything so we have Smith, Tom. The problem is that we don't get Smith, Tom, Bryson, Bill.  

 

0 Kudos
Reply
Highlighted
Nintex Employee
Nintex Employee

Re: Using a Regular Expression to Delete Characters in a Collection Variable

I would use a foreach action and pull each index out one at a time and then grab the name with a regular expression and add it to a text variable and so on.
0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: Using a Regular Expression to Delete Characters in a Collection Variable

@mrdavidcook ....I'm still trying to figure out how you're getting the values in collection variable !!!

 

I mean which attribute of the Query user profile you're pulling and I usually get a single value and not the collection if I'm using a Query user profile.

0 Kudos
Reply