Hello,
I am new to Alteryx and I am trying to split the data evenly into 3 columns but couldn't able to find a workaround to achieve this problem.
For Example: In my workflow, I am getting below output, which is not splitting correctly.
My Output Result | |||
PBS | P | B | S |
123-456789-AA | 123 | 456789 | AA |
555-6666-DDD | 555 | 6666 | DDD |
LM5555-AAA | LM5555 | AAA | |
CM666-BBB | CM666 | BBB | |
JHS55-CCC | JHS55 | CCC |
Below is the corrected output:
Correct Output Result | |||
PBS | P | B | S |
123-456789-AA | 123 | 456789 | AA |
555-6666-DDD | 555 | 6666 | DDD |
LM5555-AAA | LM5555 | AAA | |
CM666-BBB | CM666 | BBB | |
JHS55-CCC | JHS55 | CCC |
Thank you so much.
Solved! Go to Solution.
Hello @SP-90 ,
Use the following regular expression on the regex tool:
(\d{3})?-?(.*)-(.*)
set the output method on parse.
Cheers
Hello afv2688,
I used your regular expression but the output result is still not correct.
Please see below:
Output Using Regular Expression on the Regex | |||
P-B-S | RegExOut1 | RegExOut2 | RegExOut3 |
123-9999-AA | 123-9999 | AA | |
789-8888-BB | 789-8888 | BB | |
S478965-Q789 | S478965 | Q789 | |
R9999-S4579 | R9999 | S4579 | |
T78919-R5248 | T78919 | R5248 |
Correct Output | |||
P-B-S | RegExOut1 | RegExOut2 | RegExOut3 |
123-9999-AA | 123 | 9999 | AA |
789-8888-BB | 789 | 8888 | BB |
S478965-Q789 | S478965 | Q789 | |
R9999-S4579 | R9999 | S4579 | |
T78919-R5248 | T78919 | R5248 |
Thank you so much, I appreciate your help.
Hi @SP-90
My knowledge of Regex isn't quite up to the point of doing this one statement, but by adding a formula tool to artificially add a initial hyphen if it's missing, then a Regex parse on Hyphen will split and correctly align your data
Maybe @Thableaus can respond with a single Regex solution
Dan
Hello Danilang,
Thank you so much for helping.
Appreciate your help.
Hello Afv2688,
Thank you so much for your help, some how it was throwing out wrong results.
Appreciate your help!