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

Get all words that come between 2 substrings

smarapad
7 - Meteor

I have a table and one column has text like 

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Consumer contact information: John Doe (xxx)xxx-xxxx. Name of organization: Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

From this text, I only want "John Doe (xxx)xxx-xxxx.". 
Is there a way to get data that comes between the substrings Consumer contact information and Name of organization.
The text that comes before Consumer contact information can be of varying length.

2 REPLIES 2
CharlieS
17 - Castor
17 - Castor

RegEx to the rescue here. Try the following expression in a RegEx tool in Parse Mode:

 

(?<=Consumer contact information: )(.*)(?= Name of organization:)

 

RegEx breakdown:

The overall structure is that you're identifying a beginning marker, then saying you want any characters that come next until the next marker comes along. Each of these three "steps" is bound by parenthesis in the statement above.

 

The attached workflow shows this in action.

LukeG
Alteryx Alumni (Retired)

Hi @smarapad 

 

You can use the regex tool to solve this problem. I have attached a workflow that completes this task.

 

Here is documentation on the regex tool.

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Tool-Mastery-RegEx/ta-p/37689

 

Let me know if this is helpful.

 

Luke

 

Labels
Top Solution Authors