Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Numeric Wildcard in Formula Tool

MemphLantAntonio
8 - Asteroid

I do not use Regex often, but I am looking for a wildcard for any numeric character.

 

I have a long note field that contains keys for customers but these keys contain commas that need to be removed. The problem is, in order to parse it, I want to replace the comma with a space when it is a comma being used to separate distinct values of the customer number but replace the comma with nothing (remove comma) when it is within the key.

 

For example:

4,300,4,500,4,600 is a list of 3 customer numbers. In this case, I would want to replace the comma in 4,300 with nothing so it is 4300 but I would want to replace the comma between4,300 and 4,500 with a space so I can text to rows it and split them out into separate values.

 

he rules would be different for #,### as ###,#

6 REPLIES 6
BS_THE_ANALYST
15 - Aurora
15 - Aurora

@MemphLantAntonio is this what you're looking for:

Before:

BS_THE_ANALYST_0-1677867229029.png


After:

BS_THE_ANALYST_1-1677867238883.png

 

 

All the best,
BS

LinkedIN

Bulien
JVMORO
7 - Meteor

Hello, if your field is fixed, always 12 values, this can be a solution, if you have more, just add it in the formula tool

JVMORO_0-1677869750927.png

 

MemphLantAntonio
8 - Asteroid

I think these 2 are OK, I don't quite understand how the TileSequenceNum is working. I should have clarified that the note field will have high variability, and I am not sure either of these 2 can account for that. Here are more examples:

 

 

 

Note                                                         Desired text to column 1               Desired text to column 2               Desired text to column 3

4,500,6,500,7,500 are all eligible                           4500                           6500                                7500

Please add 4,500, 6,500, and 7,500 to contract X.4500                          6500                                7500

#45,500 needs to be added to contract X               45000   

 

 

 

I would just use the Data Cleansing to remove punctuation, but in example 1 it would make the 3 numbers combine into one number, and if I use space as delimeter for text to columns, it would only parse into 1 field rather than 3 separate numbers.

Yoshiro_Fujimori
15 - Aurora
15 - Aurora

Hi @MemphLantAntonio ,

 

I made a workflow which returns the same value as your sample data.

You may need to adjust the workflow with the maximum number of values in the string.

Yoshiro_Fujimori_0-1677901233009.pngYoshiro_Fujimori_1-1677901274355.pngYoshiro_Fujimori_3-1677901342075.png

 

Regex: \d*,?\d{3}

 

I hope this works.

 

Yoshiro_Fujimori
15 - Aurora
15 - Aurora

Please note the RE below may not work if the number can be less than 1000...

Please adjust it as necessary.

MemphLantAntonio
8 - Asteroid

Thank you this is what I was looking for! 

Labels
Top Solution Authors