Alteryx Designer Desktop Discussions

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

Parse string into multiple columns

alvaroez
5 - Atom

Hi friends,

 

I have a problem with some list of strings that I want to parse into multiple columns but my Regex doesn't work properly. This is how it likes:

 

\s(\d*\.*\d*)\s([\w]*)\s\w*\s(\d*)\s([\w]*)

 

And this is an example of my results:

Producto DescRegex1Regex2Regex3Regex4
SELOKEN ZOK 95 MG LIB PROL ORAL 20 GRAG   080320GRAG 803
SELOPRES ZOK 95/12.50MG ORAL 20 TAB   081020TAB 810
TALARIC 30 CAPS 0608[Null][Null][Null][Null]
SULFATO-MAG 10 % 100X10ML AMP      (HIJO)   1457    
CONCOR 1.25 MG ORAL 30 TAB   50211.25MG30TAB
INDERALICI 80 MG ORAL 20 TAB   256180MG20TAB
TENORETIC 50/12.5 MG ORAL 28 TAB   228828TAB 2288
TENORETIC 100/25MG ORAL 28 TAB   251628TAB 2516
OPENVAS CO 20/12.5MG ORAL 14 TAB 0325    
AMLODIPINO 5 MG C/10 TAB GI    3237[Null][Null][Null][Null]

 

Each part of the group is represent by a diffferent color assuming how should be working my code to group by.

 

I hope you can help me to resolve this problem.

 

 

Thank you for readme.

 

2 REPLIES 2
phottovy
13 - Pulsar
13 - Pulsar

Rows 3 and 4 are a bit tricky but I was able to get the rest of the rows using this:

 

\s([\d\/\.]+)\s*(M\w)*\s[^\d]+(\d{2})\s(\w{3,4})\s

 

I highly recommend the website regex101.com when trying to solve problems like this.

hellyars
13 - Pulsar

 

@alvaroez 

 

This is a little crude, but it gets it.  However, it assumes there are no additional data anomalies.

 

Option 1 is my first crude attempt.  Option 2 is a combo of my first attempt and @phottovy regex.

 

parse_to_columns2.png

Labels