Free Trial

Alteryx Designer Desktop Discussions

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

REGEX help to parse out numbers

lucyjohnson
6 - Meteoroid

Hello,

 

I'm new ish to Alteryx (got the core cert) but totally new to REGEX. Played around with it and cannot figure out the solution. I have part descriptions and need to pull out dimensions from them. Example below.

 

Red is what I need to get out, preserving the periods as well (as those are decimals). For simplicity, let's pretend that's width, length, and height in the format W X L X H and I need a column for W, a column for L, and a column for H as output. What's the regex expression for that? Sometimes the first dimension has a number before the period and sometimes not. Thanks for any help!

 

PLT S127 1.0000 X 96.0 X 120.0
PLT S 22 .3750 X 96.0 X 580.0
PLT S 56 3.0000 X 96.0 X 120.0
PLT S 99 .4375 X 96.0 X 240.0
PLT S215 .2188 X 51.44 X 400.0

 

2024-10-31_10-41-01.png

5 REPLIES 5
binuacs
21 - Polaris

@lucyjohnson try the below regex

(\d*\.\d+)\s*X\s*(\d*\.\d+)\s*X\s*(\d*\.\d+)

image.png

lucyjohnson
6 - Meteoroid

That worked! Thank you

terry10
12 - Quasar

@lucyjohnson 

 

Check out regex101.com

You can build regex and it will show you what matches in your test data. It also provides an explanation. See screenshot for an explanation of binuacs' regex with your sample data.

 

 regex101.PNG

terry10
12 - Quasar

BTW, if the values could be >= 10, you will want to change the + to  * 

 

Also, using the regex tool, you can name and set your parsed values to numbers instead of strings if you want.

 

 rege.PNG

flying008
15 - Aurora

Hi, @lucyjohnson 

 

FYI.

 

录制_2024_11_01_14_17_33_181.gif

Labels
Top Solution Authors