Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Parse if Capital Letter in Middle of Word

kristinaheuer
7 - Meteor

Hi - 

 

I am trying to improve a customer file - I know I won't be able to solve for many cases, but I am trying to parse names if there is a capital letter within the name. Example: SteveR I want to parse into Steve (column 1) and R (column 2). Below is a snippet of my data set for reference. 

 

kristinaheuer_0-1620830724104.png

 

5 REPLIES 5
MarqueeCrew
20 - Arcturus
20 - Arcturus

What about McMillan or HelenMcMillan?

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
kristinaheuer
7 - Meteor

Since this dataset is "first names" only, I am mostly concerned with grabbing the true first name and remove middle initials and middle names.

apathetichell
18 - Pollux

 

 

try regex_match([column],"\w+\u+\w*",0") - that worked with my dataset.

 

I'd expect REGEX_Match([test],"[a-zA-Z]+\u+\w*",0)

 

would be more precise and should be better but I'm not seeing differences on my sample data.

 

Sorry - misread your request - those would just grab which columns have a non-leading capital letter inside the field.

 

I'd do something like (\u*\w+)(\u+\w*)|(\w+) in regex tool (parse) case insensitive unchecked.

 

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@kristinaheuer ,

 

 I'd use a RegEx tool set to PARSE the [firstName] with case insensitivity option UNCHECKED 


(\u\l*)(\u*\l*)

 

 cheers,

 

 mark

 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
AdamR_AYX
Alteryx Alumni (Retired)

I have a non regex solution, but I'm not convinced it is any clearer to read than the regex answers in this case

 

AdamR_0-1620834760702.png

 

FindString(Substring(ReplaceChar([Field1], "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "*"),1),"*")+1

 

gives you the index of the first capital letter not counting the first character of the string.

Adam Riley
https://www.linkedin.com/in/adriley/
Labels