Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

RegEx parse to rows at Double pipe delimiter

sunilmandava
5 - Atom

Hi, I am trying to parse values that are separated by double pipe '||' delimiter. However, I do not like to parse if there is just one pipe '|' delimiter. For example:
Column A     Column B
1                   123 || 456 || abc

2                   123 | abc || 456

Expected output-
Column A     Column B
1                   123

1                   456

1                   abc

2                   123 | abc

2                   456

 

Can someone help me out here?

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @sunilmandava 

 

Here is how you can do it. Since text to column considers delimiter mentioned as separate delimiter and not together we need to replace " || " to a single character i am replacing it to "$" and then split to rows on "$"

 

Workflow:

atcodedog05_0-1622091906165.png

Hope this helps 🙂

apathetichell
19 - Altair

How about this one?

 

It first replaces the "||" with a tab and then splits to rows.

OllieClarke
15 - Aurora
15 - Aurora

Hey @sunilmandava 

I think the solutions offered by @apathetichell and @atcodedog05 are probably the way to go, but if you did want a RegEx solution then this works:

Tokenise to rows on this

(.+?)(?:\|{2}|$)

capturing everything before either 2 '|' or the end of a line (non-greedy)

 

OllieClarke_0-1622108374005.png

 

atcodedog05
22 - Nova
22 - Nova

@OllieClarke  Neat!! i couldnt warp my head around on how can i make it work using regex. Now i know 🙂 and using {2} was one of the thing i needed but think about 😅

Labels