We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Seperating text with Regex

gdorwart
7 - Meteor

Hello all, 

 

I've been struggling to learn seperate a line of text using RegEx. Below is the current format in Excel. 

 

 Capture 2.PNG

 

 

 

Here is the desired format after RegEx has been run:

Capture 3.PNG

 

Any help with this would be amazing!

5 REPLIES 5
FinnCharlton
13 - Pulsar

Hi @gdorwart ,

I would try something like this using the regex tool:

FinnCharlton_0-1674058580507.png

 

gdorwart
7 - Meteor

In your RegEx expression, what is the function doing exactly? Thanks for the help!

FinnCharlton
13 - Pulsar

Hi @gdorwart , it is finding every instance where there are more than two spaces in a row, and replacing it with a "|" character. We can then use Text to Columns to split on that character.

BS_THE_ANALYST
15 - Aurora
15 - Aurora

One way to do this. Attached the workflow as a file.

 

It's seperating the header column from the data below it. It's splitting the header column by the delimeter " " (a space). You can change this delimeter based on what the delimeter between your headers is. 

 

The data below it is being split using regex (.*)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s*$ this expression says that it split each record into 4 groups: it will firstly capture the name of the group i.e. accountancy 2021. Then it will proceed to capture the next 3 groups of digits i.e. 20.1   2021   0

BS_THE_ANALYST_0-1674059444736.png

 

All the best,
BS

LinkedIN

Bulien
binuacs
21 - Polaris

@gdorwart One way of doing this

 

binuacs_0-1674059852177.png

 

Labels
Top Solution Authors