Alteryx Designer Desktop Discussions

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

Trim part of text field

Sailor
7 - Meteor

Hi

 

I am struggling to solve this problem. I do a lot of data prep and blending but have not solved this problem. 

 

Original string:

125 58 Stora Mossen

 

Desired string:

12558 Stora Mossen

 

If I use trim, all spaces are removed. I can not find any suitable regex_replace pattern

 

Regards Mats

4 REPLIES 4
patrick_digan
17 - Castor
17 - Castor

@Sailor The below will work if you have one or more digits separated by one or more spaces. 

regex_replace([Field1],"(\d+)\s*(\d+)","$1$2")

  

pcatterson
11 - Bolide

If you want to remove the space in between sets of numbers, you can do that like this:

Sailor
7 - Meteor

Hi

Thanks a lot, it works fine

 

/Mats

Sailor
7 - Meteor

Hi

 

Thanks, works fine. I got one solution before yours

 

Regards Mats

Labels