Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Regex not working for name

Yuri24
8 - Asteroid

I am trying to convert name of a certain format to FirstName Lastname. My regex is not working for all scenarios.

 

Regex I am using is: ^(\w+).*?(\w+)$

Parsing into 2 names and concatenating them. However, this is not working for cases 1 and 4. 

 

Example: Trying to get Oscar Wilde from

Wilde, Oscar A.
Wilde, Oscar
Wilde Jr, Oscar
Wilde Jr, Oscar Senior
3 REPLIES 3
DanM
Alteryx Community Team
Alteryx Community Team

Because of the patterns you are suggesting, you probably won't be able to just use regex in this instance to parse everything exactly in one tool. I would suggest parsing it out first using the comma using the Text to Columns first. This would then allow you to complete the parsing using regex for both columns created no matter the pattern.

alexnajm
18 - Pollux
18 - Pollux

This expression works for these instances: ^(\w+)\s*\w*,\s(\w+).*$

 

In this case I might use the replace function in RegEx or a formula RegEx_Replace([field],"^(\w+)\s*\w*,\s(\w+).*$","$2 $1")

Yuri24
8 - Asteroid

Thanks!

Labels
Top Solution Authors