Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Help with a Regex

kas
8 - Asteroid

Hello,

 

I have a scenario I'm not sure how to get the info I need.

In the data set, I'm looking to pull the info after the word Scenario: and stop before the word Notes:

The only problem is the word Scenario shows up twice and I need the 2nd instance. Example below.

 

Thank you,

Kim

 

 
 

 

 

7 REPLIES 7
CSmith16
9 - Comet

You could try parsing it out by doing this below but you should provide this as a data set for me to download.

 

REGEX_Replace([Column Name],"(Scenario: )(.*)","($2)")

 

 

kas
8 - Asteroid

@CSmith16 

Data set added.

 

Thank you,

Kim

CSmith16
9 - Comet

Could be misunderstanding, you mean like this?

Screenshot 2024-06-05 145923.png

Formula that Converts Long Spaces:

 

REGEX_Replace([Extended comments],"(\s{2, })","|")

 

 

Formula That Parses Info Out:

 

Replace(REGEX_Replace([Extended comments],"(.*Scenario: )(.*)(Notes:.*)","($2)"),"|","")

 

kas
8 - Asteroid

@CSmith16 

 

No, I want to extract the data that is after the 2nd "Scenario:" and stop before the word "Notes:", so the end result in this example would be:

Other.

 

Thank you,

Kim

CSmith16
9 - Comet

Yes, check the screenshot the output is in the field named "Test", that is the output I received.

 

You can edit the formula to replace the current field if you don't need any of the other info, I just wanted to keep that in the answer I gave you to show as a before and after.

kas
8 - Asteroid

@CSmith16 

Sorry! I was just looking at it again and had missed the 2nd column after the Test formula - the column was so tiny I missed it at first.

 

This will work I think...thanks so much!

 

Kim

CSmith16
9 - Comet

lol no problem I figured it was just missed is all. Just wanted to make sure that is the output you needed. If this doesn't work, or you need it to be more dynamic I'd be happy to help.

Labels