ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
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
binu_acs
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