Start Free Trial

Alteryx Designer Desktop Discussions

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

Adding a space at the beginning of each string that has a number at the start

JDaviesInch
5 - Atom

I'm trying to add a space in front of any text string that has a number to begin with.

 

EG. 

 

1 Series

 1 Series

 

Is this possible? I've exhausted all of my knowledge!

 

I've tried using the formula tool but no luck.

 

Thanks

6 REPLIES 6
Luke_C
17 - Castor
17 - Castor

Hi @JDaviesInch 

 

Give this a shot, I'm using regex match to check for a pattern that starts with 0-9

 

Luke_C_0-1623331828017.png

 

mceleavey
17 - Castor
17 - Castor

Hi @JDaviesInch ,

 

Just a cheeky bit of regex:

 

mceleavey_0-1623332102872.png

 

mceleavey_1-1623332136444.png

 

 

No doubt @MarqueeCrew will slap me around again...

 

M.



Bulien

JDaviesInch
5 - Atom

Hi,

 

This works exactly what I need it to do. However, When I output to an excel file the spaces are lost. Any idea why this would be?

 

Luke_C
17 - Castor
17 - Castor

Hi @JDaviesInch 

 

Take a look at this thread. Looks like people have had luck swapping in another character or adding an apostrophe. 

mceleavey
17 - Castor
17 - Castor

@JDaviesInch ,

 

yeah, as @Luke_C  points out, this is not an Alteryx problem but an Excel problem.

 

Yet another reason why friends don't let friends Excel.

 

The reverse apostrophe ` is the hidden character to retain a leading space.

Try the following in the regex tool:

 

mceleavey_0-1623333073836.png

 

 

M



Bulien

danilang
19 - Altair
19 - Altair

Hi @JDaviesInch 

 

If you're using the non-breaking space from the post that @Luke_C mentioned, the replace field that you should in the regex tool is \xA0\d.  "A0" is the hex value for the ASCII 160

 

danilang_0-1623418208239.png

 

Dan

 

Labels
Top Solution Authors