Alteryx Designer Desktop Discussions

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

Extract Substring based on character length

jason_sheeran
6 - Meteoroid

Hello!

 

I am working on a workflow for payment application, and am looking for a way to extract a substring that starts with the number 2 and is 7 characters long. Here is an example of two fields that I need to extract:

jason_sheeran_0-1683647960332.png

 

For the first field I am looking to return "2267054" and the second field I am hoping to return "2266178". I'm thinking this could be done with the RegEx tool, but I've been having difficulty finding anything that gets the results I desire. The biggest issue is the substring is not always in the same position, like the example provided. 

 

I'm hoping someone has some ideas on how to achieve this, and thank you in advance!

3 REPLIES 3
binuacs
21 - Polaris

@jason_sheeran One way of doing this with the Regex tokenize method

binuacs_0-1683648474875.png

 

MilindG
12 - Quasar

Is it always 7 digits? 

MilindG_0-1683648552389.png

 

jason_sheeran
6 - Meteoroid

This worked perfectly thank you! One follow up question on this method: is there a way to only look for numbers of a certain length or will it look for the value "2" and grab the 6 values after it? I have some values that are unrelated to what I'm looking for, such as "230541654321", which is longer than the string I'm searching for, and it will grab "2305416". 

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels