Free Trial

Alteryx Designer Desktop Discussions

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

Create Space Before Specific Numbers

Mike_at_CG
8 - Asteroid

Hello again Alteryx Community

 

Wanted to see if there was a way to insert a space before the numbers 28 or 29 in the below data set?

 

Mike_at_CG_0-1667404341734.png

 

Given that there is already a space in the string I would need to find the numbers 28 or 29 to the right of the first space.

 

So the first example would look like 001201001 AGLXY 2800

The second example would look like 00130H105 AES 2800

 

Thank you

5 REPLIES 5
Luke_C
17 - Castor
17 - Castor

Hi @Mike_at_CG 

 

Try this formula:

Replace(Replace([Field1],'29',' 29'),'28',' 28')

 

binuacs
21 - Polaris

@Mike_at_CG One way of doing this

binuacs_0-1667405327404.png

 

 

gabrielvilella
14 - Magnetar

Hi @Mike_at_CG, maybe this regex helps.

 

(.+\D+)(28|29)(.+)

gautiergodard
13 - Pulsar

hey @Mike_at_CG 

You could do something like this!

Replace(Replace([String],'29',' 29'),'28',' 28')

gautiergodard_0-1667405252969.png

 

DataNath
17 - Castor
17 - Castor

@Mike_at_CG I think the following requirement will trip up the expressions offered so far:

'Given that there is already a space in the string I would need to find the numbers 28 or 29 to the right of the first space'

 

DataNath_1-1667476073113.png

 

I went down a bit of a string function rabbit hole but this adds in a check for the first space in the original record and splits after that - small handful of examples included.

Labels
Top Solution Authors