Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

RegEX Tokenize or Parsing Letters and Words

rkjsp613
5 - Atom

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, & Peaches123456
Kiwi and Strawberry123456
Lime123456
Green Apple (GA)123456
Peaches and Plums123456

 

I have been able to accomplish these two separately but not all in one go:

 

123456
123456
123456
123456
123456

 

Apples, Bananas, & Peaches
Kiwi and Strawberry
Lime
Green Apple (GA)
Peaches and Plums

 

Any help is much appreciate!

3 REPLIES 3
atcodedog05
22 - Nova
22 - Nova

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:

atcodedog05_0-1621504249152.png

 

Hope this helps 🙂

 

rkjsp613
5 - Atom

Thank you, this worked 😃

 

Curious though, what would be a simpler way instead of writing out the expression for the number of columns?

ChrisTX
16 - Nebula
16 - Nebula

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://community.alteryx.com/t5/Alteryx-Designer-Discussions/Automatically-Remove-all-null-Colums/t...

 

ChrisTX_0-1621508433099.png

 

https://regex101.com/ is good site to try out regular expressions

 

Chris

 

Labels
Top Solution Authors