We’ve extended Inspire Early Bird Pricing until March 1. Register now and enjoy 20% off conference passes and 10% off training passes. P.S. Don’t forget to bring friends! When you sign up for five or more tickets, you get an extra 20% discount on conference passes. Learn more now.

Alteryx Designer Desktop Discussions

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

Add Space Prior to Every Upper Case

Dom1878
5 - Atom

Hi, 

 

I've got a string field - in the format FirstnameLastname - and i'm looking to split these out, effectively for every upper case, add a space before hand. The field at the moment can contain just one name or multiple - for example FirstnameMiddlenameLastname - and again, we'd want to add a space for every upper case character. 

 

Brand new to Alteryx - so apologies if the solution is simple - any ideas? 

 

Thanks, 

 

Dom

6 REPLIES 6
patrick_digan
17 - Castor
17 - Castor

In a formula tool, try something like this

trim(REGEX_Replace([Field1],"(\u)"," $1",0))

where [Field1] is your string field.

Dom1878
5 - Atom

Worked a treat! Thank you very much for the help

LordNeilLord
15 - Aurora

Hi Dom,

 

I would:

  • add a filter and use RegEx_CountMatches([YourField],"\u.*",0)=2 to split the records into 2 and 3 name streams
  • on First stream use RegEx tool to Parse using (\u.*)(\u.*)
  • and second stream use RegEx tool to Parse using (\u.*)(\u.*)(\u.*)
  • Union the 2 streams back together

 

LordNeilLord
15 - Aurora

@patrick_digan You're too good

dali0235
5 - Atom

How would you add a comma to this formula?

trim(REGEX_Replace([Field1],"(\u)"," $1",0))

To create Last Name, First name   

I also have instances of 2 Last names:  Last Name Last Name, First Name.

Thanks so much for the help!!

fabio_mtb
5 - Atom

This is great, what I don't want a space between to capital letters? For Example I want AddressUSA to turn into Address USA not Address U S A

Labels