Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Parse Numbers

Kristie_Pires
8 - Asteroid

Hello! I am trying to parse the data to get the following result:

 

IDNew Column
500071001255600115710012556115
50007100125560009971001255699
500071001255600203710012556203

 

I can take out the four first digits with a "Right" string function, but I am not sure how to take out the zeros (only after the ...12556(take out zeroes), with the exception when the last three digits contain a number in the middle. In that case, I want to keep the zero). 

I am new to "Regex" so I don't know how to write an expression that does what I want.

 

Thank you!! 

4 REPLIES 4
PhilipMannering
16 - Nebula
16 - Nebula

Not sure if this will work for all your data, but give it a go,

PhilipMannering_0-1657297555011.png

 

OllieClarke
15 - Aurora
15 - Aurora

@Kristie_Pires How about this:

 

REGEX_REPLACE([field],'.*(710012556)0*(.*)','$1$2')

 

 

OllieClarke_1-1657297724998.png

Which removes all consecutive 0s after 710012556, as well as everything before it

 

 

 

 

edit: Ah I see @PhilipMannering has got there with a better solution :)

 

PhilipMannering
16 - Nebula
16 - Nebula

@OllieClarke I was thinking the same thing about your solution <3

Kristie_Pires
8 - Asteroid

Thank you @PhilipMannering & @OllieClarke

Labels
Top Solution Authors