ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
解決済み

Add Space Prior to Every Upper Case

Dom1878
アトム

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件の返信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
アトム

Worked a treat! Thank you very much for the help

LordNeilLord
オーロラ

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
オーロラ

@patrick_digan You're too good

dali0235
アトム

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
アトム

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

ラベル
トップのソリューション投稿者