Pulling Numbers from a String
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!
Solved! Go to Solution.
- Labels:
- Behavior Analysis
- Best Practices
- Common Use Cases
- Custom Tools
- Datasets
- Developer Tools
- Dynamic Processing
- Expression
- Gallery
- Input
- Join
- Location Optimizer
- Machine Learning
- Macros
- Optimization
- Output
- Predictive Analysis
- Prescriptive Analytics
- Reporting
- Server
- Spatial Analysis
- Tips and Tricks
- Transformation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here is a workflow that should meet your use case. It uses 2 different expressions:
- [^0-9]\d{23} to look for the first 23 digits in a sequence of at least 23 digits.
- ^\d{23} to look for the off chance the string begins with 23 digits.
Both use the "Tokenize" function and "Split To Rows"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Awesome, will try it out. Thank you for the help
