Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Finding Negative Decimal

Muhummad_Solehudin
7 - Meteor

Hi everyone,

Currently I am using the Regex tool to parse data to their specific columns. However, the parsed data are not accurate where the - v e symbol of a value was separated to other column. Is there any improvement that can be made on my expression below?

 

This are the expression that I used:

(.*?)\s(.*?)(\d+\.\d+|n\/a?).*?(\d+\.\d+|n\/a).*?(\d+\.\d+|n\/a)\s(.*?)\s(.*?)(\d+\.\d+|n\/a?).*?(\d+\.\d+|n\/a).*?(\d+\.\d+|n\/a)

 

This are the input:

1 Finland 1.38 100.00 1.00 74 Malawi –0.07 64.39 0.48

47 South Africa (2007) 36.76 40.01 0.56 n/a Iceland n/a n/a n/a

n/a United Kingdom n/a n/a n/a n/a Kyrgyzstan n/a n/a n/a–1.05 40.44 0.15

1 REPLY 1
asyraf__razak
7 - Meteor

Hi,

 

Based on your problem, here is my opinion.

 

If the field you're capturing has the potential to have a negative sign in front of it, then one solution is to put a [^\w]? at the beginning of the expression capturing numeric values. In this case, the updated RegEx will look like.

asyraf__razak_0-1621324533083.png

I attached the regular expression and the workflow as well. 

 

Hope this helps. Cheers

Labels
Top Solution Authors