In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more 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
binu_acs
21 - Polaris

@gdorwart One way of doing this

 

binuacs_0-1674059852177.png

 

Labels
Top Solution Authors