Start Free Trial

Alteryx Designer Desktop Discussions

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

Parsing numbers from String at random position

Jasdev
8 - Asteroid

Hi,

I have been trying to find an answer to my scenario of how to split out the String part and Numeric part separately from a string containing number at a random position. To ease out this thing, number would only be at a single position. For example, 3 of the sample records are:

text1 abc pqr 98710

text2 21270

25836 text3 abc

text4 51271 abc

12121 text pqr

 

There surely wont be a scenario where I will have something like 12121 text pqr 12345 (Group of number occuring twice). Also, the placement of group of numbers can be at any place, starting, anywhere in middle or at the end. Is there a way I can extract those group of numbers in a seperate column?

6 REPLIES 6
echuong1
Alteryx Alumni (Retired)

You can use the regex tool with the parse method. See attached. 

 

echuong1_0-1581541419574.png

 

fmvizcaino
17 - Castor
17 - Castor

Hi @Jasdev ,

 

Attached is an example showing how to do it.

I've created two regular expressions, the second one considering that you are going to have single digits alongside your texts, such as 'text1' and the first one not considering it.

 

Best,

Fernando Vizcaino

Jasdev
8 - Asteroid

Does this (\d{5}) means wherever it find any group of numbers of length 5, it extracts them?

This group can be of any length more than 3 so what would the expression change into?

Also, if I need to have 2 columns, one with what you are generating and one of only text part?

Jasdev
8 - Asteroid

I think below parse would solve my scenario but can you explain if (\d{2,}) means any group of number more than 2? Does it include 2 as well? My number group range can be anything more than 3. Also, how to have another column with textual part only?

fmvizcaino
17 - Castor
17 - Castor

Exactly!! \d{2,} means 2 digits or more.

Example attached for second part.

 

Best,

Fernando Vizcaino

Jasdev
8 - Asteroid

It worked. Amazing. Thank you so much for such quick help.

Labels
Top Solution Authors