Start Free Trial

Alteryx Designer Desktop Discussions

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

Need help parsing data - RegEx? Text to columns?

John_CMO
7 - Meteor

Have several lines of data where I need to parse out specific pieces of data 

 

Example:

 

Customer PAGE1234 / P AGE LLC Type: Paypal Phone: 123 123-1234

 

I guess I need to be able to configure where the parse starts and stops considering I have several lines of similar data and some names are longer than other. Is there a way to parse this information out into new columns given the character numbers will vary per column? 

 

Thanks

 

13 REPLIES 13
alexnajm
18 - Pollux
18 - Pollux

Regex is your best bet! You can use the Parse method to define patterns that follow what you need. Based on what you have (assuming Customer, Type, and Phone will always be there and the spacing/punctuation will be consistent), this should work.

 

Customer\s(.+)\sType:\s(.+)\sPhone:\s(.+)

John_CMO
7 - Meteor

The spacing will not be consistent considering length of customer name will vary. Will this still work?

alexnajm
18 - Pollux
18 - Pollux

By spacing I mean the number of spaces, not the position

 

Please try the solution and come back with any concerns :) sample data would also be beneficial

John_CMO
7 - Meteor

It populates the columns but did not successfully parse. 

alexnajm
18 - Pollux
18 - Pollux

You aren’t really giving me much to work with… please provide your sample data and your expected output. From the above, it looks like you wanted to parse out anything after those labels so that is what’s reflected

John_CMO
7 - Meteor

The example above is what I am trying to parse. Each item in red text should be in separate columns (So 4 columns in total).

 

Page1234 - Customer Code

Page LLC - Customer Number (So everything after the "/" to the word "Type")

Paypal - Method of payment

123 123-1234 - Phone number

alexnajm
18 - Pollux
18 - Pollux

Then adjust the Regex accordingly

Customer\s(.+)\s\/\s(.+)\sType:\s(.+)\sPhone:\s(.+)

John_CMO
7 - Meteor

It's creating the columns in the output but not parsing the data. Do I need to update any parameters in the RegEx tool? 

alexnajm
18 - Pollux
18 - Pollux

I can’t help any further without screenshots of what you are actually doing in the configuration - or just attach the workflow itself. The code worked for me

IMG_7791.jpeg

Labels
Top Solution Authors