You are viewing limited content. For full access, please sign in.

Question

Question

Multi Valued token - Pattern Matching Help

asked on January 19, 2018 Show version history

Hi all,

I'm trying to formulate a pattern to create a mulit-valued token for items in my data source that are separated by a semi-colon.  For example, if I have the following in the Owner column "Owner One; Owner Two", I need "Owner One" and "Owner Two" to be mapped into two entries for a multi-valued field.  This issue is the Owner value is not always an alphanumeric value.  It can contain special symbols and spaces. I need a pattern that basically says match everything until the semi-colon as a token and everything beyond it until the next semi-colon as the next token - if there is a semi-colon present. 

I've tried: (\w+ \w+);? This returns the correct values but only if I know how many words to expect and the column doesn't contain any symbols.

If I try: (.+);?  This returns too much instead of each value that is separated by a semi-colon.

Any help is much appreciated!
Jen
 

0 0

Answer

SELECTED ANSWER
replied on January 20, 2018

This should also work Jen,  (.+?);|(.+)  

You were close with (.+);? but the question mark needs to go inside the parens,  (.+?);
Without the question mark the (.+); will match everything up to the last ;   (it's greedy)    The question mark tells the match to be non-greedy and only match to the first ; found.   We add the |(.+) to grab the last value in the line

0 0
replied on February 2, 2018

This works great!  Thanks, Andrew!

0 0

Replies

replied on January 19, 2018 Show version history

If you're doing this in Workflow, you should be able to add a For Each Value activity, add the token for your column, open the Token Editor and apply a Split function with the semicolon as the delimiter.

Next, put an Assign Field Values activity inside the For Each, choose your multi-value field, set it to Append, and set the value as the ForEach_CurrentValue token.

Just to be sure, I usually add the function to remove empty values after the Split so I don't end up with any empty "rows"

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.