Alteryx Designer Desktop Discussions

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

Pulling Numbers from a String

mfranchino21
7 - Meteor

Hi, I want to pull a 23 digit number from a string. The number sometimes may be longer, but i only want the first 23 digits. There also may sometimes be more than one 23 digit numbers in one string. Here is an example:

 

-Test words test words 12345678910111213141516TTTtest words test words123456789101112131415169999.99 test test test 12345678910111213141516McC

 

From here, I would want the output to be the three numbers that are 23 characters long, and only the first 23 characters. Right now Im using RefEX (\d[23]) and its outputting numbers longer than the max of 23 i want, also not accounting for all three of the possible outputs, and just displaying the first one. 
I also am looking for one independent output for each input. 

Here is an example

 

Input: 

Test words test words 12345678910111213141516TTTtest words test words 123456789101112131415169999.99 test test test 12345678910111213141516MCC

 

Output:

12345678910111213141516

12345678910111213141516

12345678910111213141516

 

In an essence, each 23 digit number would have its own output to that one input. 

 

Ive also tried using text to columns, but i can seem to make a custom delimiter to separate the data. 

 

Thanks!

2 REPLIES 2
AndrewDMerrill
13 - Pulsar

Here is a workflow that should meet your use case. It uses 2 different expressions:

  1. [^0-9]\d{23} to look for the first 23 digits in a sequence of at least 23 digits.
  2. ^\d{23} to look for the off chance the string begins with 23 digits.

Both use the "Tokenize" function and "Split To Rows"

2023-11-15_14-01_RegEx.png

mfranchino21
7 - Meteor

Awesome, will try it out. Thank you for the help

 

Labels