Start Free Trial

Alteryx Designer Desktop Discussions

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

REGEX: Extracting Only Numbers

Cfdiaz2103
8 - Asteroid

Hi everyone!

 

I'm having some trouble with a Regex Tool. Currently, the Regex Tool I configured extracts a number of a text, ignoring the A-Z characters, and the punctuation marks as well.

 

Here's the current configuration of the Regex Tool:

".(\d{8}.\d+)|.(\d{9})|.(\d{8})|.(\d{6})|.(\d{5})"

 

Cfdiaz2103_1-1646847122670.png

 


As you can see, the only numbers that will be parsed are the ones whose length is equal to 5, 6, 8 or 9.

 

However, there's a value that contains a 4-digit value I need to parse, but it also contains another 4-digit value that is related to the current year.

 

Here's an sample of the value I mentioned:

 

"hns-npazymin,13/1/2022 TMF TTG 3450 $50,00 C 0581982745 DAVE"

 

Does anyone know how I could parse the "3450" value, instead of "2022" value, without changing the current Regex Tool configuration at all?

 

Thanks!

8 REPLIES 8
atcodedog05
22 - Nova
22 - Nova

Hi @Cfdiaz2103 

Can you provide some sample input and expected output It will help us get a better understanding of the usecase.

We will be happy to help : )

Cfdiaz2103
8 - Asteroid

Hi @atcodedog05 !

 

Sure.

 

I'm sharing with you this sample data, and the desired result.

 

I forgot to mentioned that the current Regex Tool configuration is parsing numbers whose length are even greater than 5, 6, 8 or 9.

 

I'd appreciate any kind of support.

 

Thanks in advance

atcodedog05
22 - Nova
22 - Nova

Hi @Cfdiaz2103 

 

Here is one way of doing it.

 

atcodedog05_0-1646848878494.png

 

Hope this helps : )

 

Cfdiaz2103
8 - Asteroid

Hi @atcodedog05 !

It worked great. However, it works whenever the field "Additional info" contains the "TTG" characters. I realized there are some other records that contains other parameters , like these ones I'm sharing with you (Sample REGEX 2.xlsx):

 

 

For these cases, the Regex expression doesn't work.

 

I'd appreciate your help with this issue.

 

Thanks

binu_acs
21 - Polaris
atcodedog05
22 - Nova
22 - Nova

Hi @Cfdiaz2103 

 

I am able to get expected except for the highlighted row. For highlighted it's taking second occurrence.

 

atcodedog05_0-1646889769716.png

 

@PhilipMannering do you want to pitch in on this if you have some free time?

 

Hope this helps : )

Cfdiaz2103
8 - Asteroid

Hi @atcodedog05 !

 

Sure. That record is a pain in the neck 😅.

 

I have a question... Is it really necessary to add the blank spaces into the "Prep Data" field, in order to be parsed by the Regex Tool configuration? (Sorry, Regex Tool is very tricky to me 😆)

 

Thanks for your help!

atcodedog05
22 - Nova
22 - Nova

Hi @Cfdiaz2103 

 

For the regex pattern I am using its necessary. 

 

Hope this helps : )

Labels
Top Solution Authors