Alteryx Designer Desktop Discussions

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

REGEX parse

lavorarchi
7 - Meteor

Hi 

 

In the process of learning REGEX and would be grateful if someone can please tell me how I can parse the following line into 7 different columns from one filed please?

 

01-OCT-21 ABCDE F/GHIJK LMNO 10,999 123.89 0.00 0.00 456.89

 

These are the column values:

01-OCT-21

ABCDE F/GHIJK LMNO

10,999

123.89

0.00

0.00

456.89

456.89

 

Thanks

7 REPLIES 7
pedrodrfaria
13 - Pulsar

Hi @lavorarchi 

 

There are definitely different ways to approach this. But here is one way to parse it out:

 

(\d*-\w*-\d*)(\D*)(\d+.\d+)\s*(\d+.\d+)\s*(\d+.\d+)\s*(\d+.\d+)\s*(\d+.\d+)\s*

 

pedrodrfaria_0-1615383667470.png

 

Pedro.

 

lavorarchi
7 - Meteor

Thank you very much!

fmvizcaino
17 - Castor
17 - Castor

Hi @lavorarchi ,

 

For this, we can use the following expression.

([^\s]+)\s([^\d]+)\s([^\s]+)\s([^\s]+)\s([^\s]+)\s([^\s]+)\s([^\s]+)

 

([^\s]+) = everything but a space multiple times

([^\d]+) = everything but a digit

 

Best,

Fernando Vizcaino

lavorarchi
7 - Meteor

Thank you appreciate it.

MarqueeCrew
20 - Arcturus
20 - Arcturus

@fmvizcaino ,

 

 did you know that:  \D the is

([^\d]+) = everything but a digit

 

(\D+)

 

 cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
lavorarchi
7 - Meteor

@pedrodrfaria This has worked perfectly. I have some lines of data where the number is absolute and with some lines numbers are with decimals. (\d+.\d+) seems to work with where there are decimals - what is the expression to include anything which is 1-0 ie numbers with or without decimals?

fmvizcaino
17 - Castor
17 - Castor

@MarqueeCrew , I had no idea.

 

Thanks a lot, that is so much cleaner!  😃😃😃😃😃

Labels