Alteryx Designer Desktop Discussions

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

Extract right digits from string

taxaccountant1
6 - Meteoroid

 

I am a newbie to Designer and have a csv file in which I need to parse values located at the end of every string. Some values have decimals, some don't, and those that do can have varying numbers of decimal places. I am trying to use a regex and am getting close but no luck. I am trying to start at the end of the string, and parse the value at the space or quotation mark (as each line has this in common). Any formula suggestions?

 

5 REPLIES 5
MarqueeCrew
20 - Arcturus
20 - Arcturus

Somethings like this should get you close:

 

Regex_Replace([field],"(.*\d)(.*)",'$1')

 

 that will look for the last digit and then clobber everything else. 

cheers,

 

 mark

 

 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
danilang
19 - Altair
19 - Altair

Hi @taxaccountant1 

 

To extract the final number from your sample data you can use the following regex

 

.*?(\d*\.{0,1}\d*)$

 

resulting in 

 

r.png

 

Dan

taxaccountant1
6 - Meteoroid

Thanks for your response Dan! Hope you have a happy New Year!

Dreinagel
6 - Meteoroid

How could you modify this to keep a negative sign prior to the number?

 

Sammie
6 - Meteoroid

Hi,

 

I got a similar issue whereby i need to extract the date out (example below, please note lenght of text varies but it will always ends with DD-MMM-YYYY).

 

Daily PL Adj 13-Oct-2020

 

Using below .*?(\d*\.{0,1}\d*)$, i managed to extract 2020 how i do extract 13-Oct-2020 out? 

 

thanks

 

Labels