Hi all, I am fairly new to using Alteryx and RegEx and am a little stuck! I am trying to have this:
| Apples, Bananas, & Peaches 1 2 3 4 5 6 |
| Kiwi and Strawberry 1 2 3 4 5 6 |
| Lime 1 2 3 4 5 6 |
| Green Apple (GA) 1 2 3 4 5 6 |
| Peaches and Plums 1 2 3 4 5 6 |
turn into this:
| Apples, Bananas, & Peaches | 1 | 2 | 3 | 4 | 5 | 6 |
| Kiwi and Strawberry | 1 | 2 | 3 | 4 | 5 | 6 |
| Lime | 1 | 2 | 3 | 4 | 5 | 6 |
| Green Apple (GA) | 1 | 2 | 3 | 4 | 5 | 6 |
| Peaches and Plums | 1 | 2 | 3 | 4 | 5 | 6 |
I have been able to accomplish these two separately but not all in one go:
| 1 | 2 | 3 | 4 | 5 | 6 |
| 1 | 2 | 3 | 4 | 5 | 6 |
| 1 | 2 | 3 | 4 | 5 | 6 |
| 1 | 2 | 3 | 4 | 5 | 6 |
| 1 | 2 | 3 | 4 | 5 | 6 |
| Apples, Bananas, & Peaches |
| Kiwi and Strawberry |
| Lime |
| Green Apple (GA) |
| Peaches and Plums |
Any help is much appreciate!
Solved! Go to Solution.
Hi @rkjsp613
If you want to do it in 1 step you can use below regex in regex tool parse mode
(.+)\s(\d)\s(\d)\s(\d)\s(\d)\s(\d)\s(\d)
Workflow:
Hope this helps 🙂
Thank you, this worked 😃
Curious though, what would be a simpler way instead of writing out the expression for the number of columns?
First use a RegEx tool in Parse mode: (.+?)\s(\d.*)
The ? is a lazy quantifier, which will match as few characters as possible.
Then use a Text to Columns tool with a space delimiter
This post will help remove extra null columns:
https://regex101.com/ is good site to try out regular expressions
Chris
