Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Extracting Text from Middle of Data

StrategyMan
5 - Atom

Hi Alteryx Community! I am trying to extract names from data that also includes information that I do not need, which is located to the left and right of the full name. As evidenced below:

 

Customer Name:                    JAMES SMITHS                                       Vehicle Number:                                 12345678

 

I would like to have the output extract, "FIRSTNAME LASTNAME" and remove all other information.

 

I have tried REGEX, Left() and Right(), but I cannot seem to find the solution. Any help would be greatly appreciated! 

3 REPLIES 3
danilang
19 - Altair
19 - Altair

Hi @StrategyMan 

 

If your data is always of this form then this expression in a Regex Parse tool with output method set to Parse should work for you

 

 

.*?\s{2,}(.*?)\s{2,}

 

 

Break down

.*?   any number of characters non-greedy

\s{2,} 2 or more consecutive spaces

(.*?) any number of characters non-greedy.  this is only marked group so it will show up in the output

\s{2,} 2 or more consecutive spaces

 

Dan

PhilipMannering
16 - Nebula
16 - Nebula

Looks like you could also use the GetWord() function,

 

The index is 0 based (ie first word is at position 0)The index is 0 based (ie first word is at position 0)

StrategyMan
5 - Atom

@PhillipMannering and @danilang thank you both for the solutions. 

 

They both worked and were instrumental in getting this solved.

 

Much obliged!

Labels
Top Solution Authors