In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx Designer Desktop Discussions

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

RegEx Parse return text between 2 specific words

elclark
8 - Asteroid

Hello - I have a block of text that I am trying to pull a specific string that is between 2 words. What I think is the problem is that "ID:" occurs multiple times within the string of text however I just need it to return whatever comes after ORIG: and before the first instance of ID:

 

"some text with random words and numbers 12351 more words ORIG: text I need to pull 1235 words ID: 190355 more words ID: 13565 more words ID: 65168"

 

I want the results to be "text I need to pull 1235 words"

 

This is the expression that I'm using. I'm successfully parsing after the ORIG: however, it's pulling everything up until the last ID instead of the first one.

(?<=ORIG:)(.*)(?=\sID:) 

3 REPLIES 3
flying008
15 - Aurora

Hi, @elclark 

 

Try this:

 

(?<=ORIG:\s)(.*?)(?=\s?ID:)

 

aatalai
14 - Magnetar

@elclark does this help

Deano478
12 - Quasar

Howdy @elclark you can use the Regex tool in Parse mode with this expression and it should do the trick:

 

ORIG:\s*(.*?)\s*ID:
Labels
Top Solution Authors