Alteryx Designer Desktop Discussions

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

Regex to replace every character with a space

Bobbins
8 - Asteroid

Hello All,

 

Odd request this and my regex is failing me. I need to take a column and basically have the text string have as many " " as it does letters. (Appreciating this will be an empty field full of dynamic spaces depending on cell string length).

I did try REGEX_Replace([My data],"\.", " ") but I still get the text, What's the correct regex? 

 

Thank you

 


Data:

 

My DataLength of String
To Check8
My Birthday11
Happy Birthday14
6 REPLIES 6
IraWatt
17 - Castor
17 - Castor

Hey @Bobbins,

😄 that is an odd use case! You dont need the backslash as that escapes the special character. What you want is this:

REGEX_Replace([My Data], ".", " ")

If you want to learn more about Regex the community has some really quick interactive videos on getting to grips with it here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Parsing%20...

 

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

DataNath
17 - Castor

@Bobbins you just need to remove the \ where you have \. as your target. Escaping it with the backslash means Alteryx is looking for fullstops, whereas a . on it's own indicates any character:

 

DataNath_0-1660648665745.png

 

Bobbins
8 - Asteroid

@IraWatt  @DataNath Ah doh. Thank you both! I was using Regex101 and it has a / to start.

So unusual eh? I need this because I have a graph which I need the Y axis which is full of names to look like this:

 

Bob - Birthday

Jane

Tom

Tammy - Happy New Year

Logan

Paul

 

Jane, Tom, Logan and Paul all have the same as Bob or Tammy (relative) but it looks messy if they all say it, so I can just manipulate the text field to have a large gap for them and all looks better.

Odd i know! 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Bobbins ,

 

 isn't this easy to read?

 

Padleft("", length([field]," ")

 

 no RegEx to harm the workflow

 

659C81C3-A0A5-4A3C-98EF-F2C7827DFAFF.jpeg

cheers,

 

mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Bobbins
8 - Asteroid

@MarqueeCrew  I didn't even know about this function, thats so much quicker (and easier!). Thank you!!

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Bobbins ,

 

 it's a very useful function along with its sister, padright(). 

cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels