In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx Designer Desktop Discussions

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

RegEx: inserting space in text

Kwaku_Od
7 - Meteor

I am trying to insert a space in my text in the column 'CountyX'. How can I do that with RegEx? Can someone help me please?

9 REPLIES 9
AngelosPachis
16 - Nebula

Hi @Kwaku_Od ,

 

Can you provide a sample input and a desired output, as from the provided screenshots it's hard to tell what you're trying to do. Are you trying to add a space before the second capital letter in your CountyX column?

 

EDIT : If that's the case and County is present and appears last in all your records, you can try replacing that very text with a space and then add the string "County" after it. No need to use a regex tool, a formula tool will do it.

 

AngelosPachis_0-1630776652514.png

 

 

Thanks,

Angelos

danilang
19 - Altair
19 - Altair

Hi @Kwaku_Od 

 

An equivalent regex would be 

regex_replace([Field1],"(.*?)(County)","$1 $2")

 

If you're using the Regex tool

 

danilang_0-1630847642635.png

 

If you're modifying the input string directly, remember to increase its length using a select so you don't end up dropping the "y" from "County"

 

Dan

Kwaku_Od
7 - Meteor

Hi Angelos,

Thanks for your help. So I am basically trying to remove the "Total" at the end of this string. That is why I ended up using the multistep approach. Is there a way I could use RegEx to delete it directly?

Kwaku_Od
7 - Meteor

Thanks for your help Dan! How do I modify the code to remove a specific word "Total" in the string?

atcodedog05
22 - Nova
22 - Nova

Hi @Kwaku_Od 

 

Why not just use replace function like this

 

Replace([County], " Total", "")

 

Hope this helps : )

atcodedog05
22 - Nova
22 - Nova

Hi @Kwaku_Od 

 

Can you provide some sample input and expected output it will help us get a better understanding of the usecase. I will try to provide you a solution early as possible ðŸ™‚

Kwaku_Od
7 - Meteor

Thank you ! This worked!

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @Kwaku_Od 

Cheers and have a nice day!

alt_marsan
8 - Asteroid

Thanks for the simpler solution, @atcodedog05

Labels
Top Solution Authors