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

Add character in string before first number occurrence

luismorales
5 - Atom

Hi All,

 

I'm cleaning up addresses and I need to add a comma and a space before and after each set of numbers i.e.

 

Av. El Parque 4160 Piso 5  needs to be 

Av. El Parque, 4160, Piso 5

 

This is not always the case, heres a piece of my dataset

 

Av. Santa Maria 2474, Providencia

Los Carreras 444, Melipilla

Rosario Norte 407, Piso 13, Las Condes

Huérfanos 670

La Concepción 332, Piso 7

 

So the thing is, sometimes there are 3 number characters with a comma at the end, also sometimes there are 4 number characters with a comma at the end and sometimes there are no commas.

 

Is there a way to do this using regex or should I just star making a Find and Replace table.

 

Thanks!

3 REPLIES 3
DataNath
17 - Castor
17 - Castor

Hey @luismorales, this works with your example as you mentioned it's needed when there are 3/4 numbers but I'd check it with a larger dataset and see if any issues come up that may need to be addressed with other logic etc:

 

DataNath_0-1683734877093.png

FinnCharlton
13 - Pulsar

Hi @luismorales , this Regex works for your given examples:

FinnCharlton_0-1683734891563.png

 

luismorales
5 - Atom

@FinnCharlton , @DataNath. thank you very much both approaches worked.

Labels
Top Solution Authors