Alteryx Designer Desktop Discussions

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

Designer| Text Extraction from String

Mj9715
8 - Asteroid

Hi All 

 

I have a Name field as below and need to extract the initials as shown in the field "initial". The problem is the varying lengths of first names making it difficult to use regex. I tried "REGEX_Replace([Surname], ".....(.*)", "$1")", however it works only for first names with five letters because of the five dots ".....". 

 

Is there a way to drop the first word of the string, that occurs before a space? Then whatever remaining needs to be initial.. Attached excel with surnames and the desired initials that needs to recreated. 

InitialSurname
PD & JAMARTIN P D & J A
AH & MMRILEY A H & M M
PADDOCKN PADDOCK
NDALE N
JE & MYARNALL J E & M
TW & CHUFYLEE T W & CHU F Y
3 REPLIES 3
atcodedog05
22 - Nova
22 - Nova

Hi @Mj9715 

 

Here is how you can do it.

Workflow:

atcodedog05_0-1643872990612.png

 

Hope this helps : )

 

Mj9715
8 - Asteroid

@atcodedog05 Thank you :) - this works almost always. There is one exception though - in cases where there is two names such as SPENCER D & SIMPKIN A L - i would only need D & AL instead of D & SIMPKIN A L which is the case now. 

 

Any way I can fix this?

 

 

atcodedog05
22 - Nova
22 - Nova

Hi @Mj9715 

 

Sorry, this is an outlier trying to include this might break the code.

 

Happy to help : )

Cheers and have a nice day!

Labels