Alteryx Designer Desktop Discussions

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

RegEx of 2 words

selsset97
7 - Meteor

Hi Community,

 

I am trying to parse a column with many words in the following way:

Separate the first 2 words from the rest of of the content

 

<Input>

selsset97_0-1669867091789.png

 

 

<Desired output>

selsset97_1-1669867100226.png

 

Any advice on how to do do it?

 

Thank you!

 

 

2 REPLIES 2
apathetichell
18 - Pollux

This would be easier with:

formula tool - new field -  first two words:

GetWord([field],1)+" "+GetWord(field,2)

 

formula tool - new field - "remainder"

replace([field1],[first two words]+" ","")

flying008
14 - Magnetar

Hi, @selsset97 

 

If your string include more repeat words, maybe you can use the below formula:

1- First 2 words:

REGEX_Replace([Plants], "^([[:alpha:]]+\s[[:alpha:]]+).+$", "$1")

 

2- Other last words:

Trim(REGEX_Replace([Plants], "^" + [First], ""))

 

flying008_0-1669874452546.png

 

Labels