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. 🙂
Solved! Go to Solution.
Is the X number of characters fixed, or do you expect to control it externally?
The simple case could boil down to:
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+
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.
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.
@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).
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.
Try replacing it (.{10}) it will work.I hope this helps.
Thanks
@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.
This worked once I corrected an error in my syntax. Thanks!
@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+)