Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Regex to parse numbers and text

wellington_costa
6 - Meteoroid

Hi, I have the following data that needs to be entered in 5 columns:

well_pcosta_1-1588819153932.png

How can a Regex be used to do this?

 

Thanks.

5 REPLIES 5
fmvizcaino
17 - Castor
17 - Castor

Hi @wellington_costa ,

 

This is a fixed width file problem so you can open your txt file as a .flat file and select the 'fixed width text file' as image below.

fmvizcaino_0-1588821308103.png

 

Then after confirming, it will open a layout pop-up where, by clicking, you decide where to cut your columns.

fmvizcaino_1-1588821385527.png

 

I'm sharing an example with you. To open the file layout, see image below.

fmvizcaino_2-1588821455195.png

 

 

Best,

Fernando Vizcaino

 

 

wellington_costa
6 - Meteoroid

H/i, @

 

sorry, the data is incomplete, not all strings are the same length. I updated the data.

 

 

 
 
 

Thank you for your help!

 

 

fmvizcaino
17 - Castor
17 - Castor

Hi @wellington_costa ,

 

As I'm looking at it, I will still use a bit of fixed width for the first 2 columns and them regex for the last 3.

 

Example attached.

Best,

Fernando Vizcaino

wellington_costa
6 - Meteoroid

It worked perfectly, thanks!

terry10
12 - Quasar

Using the attached workflow cleans your data up nicely. The trick was to RegEx it from both ends, leaving the remainder in column 2, and then removing the contents of  3,4, and 5 from Column 2. Is this helpful?

 

ss regex.PNG

Labels