community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Add Space Prior to Every Upper Case

Highlighted
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

In a formula tool, try something like this

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

where [Field1] is your string field.

Atom

Worked a treat! Thank you very much for the help

Alteryx Certified Partner

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

 

Alteryx Certified Partner

@patrick_digan You're too good

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!!

Labels