Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Using Regex to extract data from a body of text

kas
8 - Asteroid

Hello,

Will try and make this as little confusing as possible. I am parsing out a piece of text out of a larger body of text that contains
multiple dates, text and numbers, but only if it follows a certain phrase, and then don't include all the text afterward. My current
expressions pulls the correct info, but I get all the text/numbers/dates etc after it as well with how my expression is currently written.

 

I have two different expressions that pull from the same body of text, currently set up using two Regex tools.

1st current expressions -  (CIP check required?:)(.*)  which has two possible answers - Yes or No

2nd current expression - (CIP Check done on:)(.*) which will be followed by a date, for example 4/30/2020

 

The text format is consistent that it will always follow the statement in the brackets, and the answers are always in the
same format listed above as well.

 

Thank you,

Kim

 

Sample of text attached

3 REPLIES 3
jeff_reynolds
10 - Fireball

This is a slightly different way of going about it, but I think it's doing what you wanted. It's a fairly simple workflow, so it should be easy enough to follow along. 

 

Good luck!

 

 

T_Willins
14 - Magnetar
14 - Magnetar

Hi @kas,

 

If you want to use RegEx to parse, try the following expressions, which limit the data:

 

(CIP check required\?:)\s+(\w{2,3})

(CIP Check done on:)\s+(\d+/\d+/\d+)

 

The \s+ eliminates the spaces to avoid data cleansing 

kas
8 - Asteroid

This is perfect @T_Willins !

With only a minor tweak to my workflow I'm able to make it work perfectly, thanks so much!

Labels