Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Extracting first 3 Words after a Specific Word

insomned
8 - Asteroid

Hello,

 

I have a bunch of data and need to extract the first 3 words after the words DOF or Met or Clerk.

 

For example:

 

DOF Monica Harris Lalala - Monica Harris Lalala

Met Forrest Gump Hello Goodbye - Forrest Gump Hello

 

And so with Clerk. 

 

Does anyone know how to achieve this?

 

Thanks!

4 REPLIES 4
binuacs
21 - Polaris

@insomned 

 

Regex_Replace([Field],”DOF|MET|Clerk\s(.*)”,”$1”)

DataNath
17 - Castor
17 - Castor

Hey @insomned, quite a few ways of doing this. One of them you could use a RegEx tool in Parse mode, with the following expression:

 

(?:DOF|Met|Clark)\s((?:[^\s]+\s){2}[^\s]+)
insomned
8 - Asteroid

Thank you, and how do I parse 2 first words? Thanks!

DataNath
17 - Castor
17 - Castor

Hey @insomned, could just change the {2} to {1} if you only wanted two words after those 3:

 

(?:DOF|Met|Clark)\s((?:[^\s]+\s){1}[^\s]+)
Labels
Top Solution Authors