Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Help with Regex syntax

lmaughan
7 - Meteor

I am a newbie to Regex and need to know if it is possible to search for a text string and then return X number of characters AFTER the string (not the string itself).  Is that possible to do in Regex?

 

Here are the details.

 

Example text stored in a single field:

Performance Obligation Line Item: ROY SUB - Memo Line: - Revenue Rule Name: IMMEDIATE - Revenue Contract Number: 350123 - Performance Obligation Number: 987654 - Performance Obligation Line Number: 1 Source Document Number: 7650008446 - So

 

The data I want to parse out is the number after "Source Document Number:"

7650008446 

 

Is Regex capable of searching for "Source Document Number:" and then returning the data AFTER "Source Document Number"?  I am looking to get the result of "7650008446 ".

 

Thanks in advance for your help on this. 🙂

 

8 REPLIES 8
TerryT
Alteryx Alumni (Retired)

Is the X number of characters fixed, or do you expect to control it externally?

 

The simple case could boil down to:

TerryT_0-1599753249597.png

 

vizAlter
12 - Quasar

Hi @lmaughan — You can do it by using "RegEx" tool from "Parse" ribbon tab

 

Use "Tokenize" for the Output Method:

 

(?!.*\Source Document Number:\s)\d+

 

 

vizAlter_0-1599754888485.png

 

If it resolves your query Please mark it "Solved" or "Solved" with a Like. This will help other users find the same answer/resolution.  Thank you.

lmaughan
7 - Meteor

i am not getting any results, could you please check my syntax to ensure I have it correctly entered? RegExout1 column is all null.

 

I am assuming the {.10} specifies the number of characters to parse after the Source Document Number:

There is a space after the : and the start of the 10 digit number.  Does that make a difference?

 

Many thanks.

 

 

vizAlter
12 - Quasar

@lmaughan — Did you try what I answered you in your post?

You can see that it works even if number length is less or more (refer to the screenshot and attached workflow).

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Help-with-Regex-syntax/m-p/631809/high... 

 

grazitti_sapna
17 - Castor

Hi @lmaughan , I have checked the attachment there is just a minor mistake rest the syntax is correct. Please have a look at the screenshot you attached (.{10]) you have used a square bracket instead of curly bracket that is why your end result is null.

 

grazitti_sapna_0-1599801868299.png

 

Try replacing it (.{10}) it will work.I hope this helps.

 

grazitti_sapna_0-1599802209396.png

 

Thanks

Sapna Gupta
lmaughan
7 - Meteor

@vizAlter I did try the tokenize solution that you provided, but in my larger dataset -- it is parsing the first number in the dataset rather than the number following the "Source Document Number:" pattern.  I am in the process of adding more samples to the example you provided for additional troubleshooting.

lmaughan
7 - Meteor

This worked once I corrected an error in my syntax.  Thanks!

vizAlter
12 - Quasar

@lmaughan — Main thing was the expression, you can use that through Tokenize or Parse output method.

Hope the attached workflow will be helpful.

((?!.*\Source Document Number:\s)\d+)

 

Labels