Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

How to use Regex function to extract numbers(with decimals) from a string?

rajputakansha
8 - Asteroid

Hello,

 

I have a scenario where I need extract amounts from a string. This could be achieved either by using regex function or pulling amounts from the end of the strings.

 

Can someone suggest a dynamic solution to this problem?

 

FieldOutput
0,AAA None]||||ABB_BALANCE|9090
0,AAA None]||||ABB_BALANCE|00
0,AAA None]||||ABB_BALANCE|00
0,AAA None]||||ABB_BALANCE|80.3080.3
0,AAA None]||||ABB_BALANCE|00
0,AAA None]||||ABB_BALANCE|00
0,AAA None]||||ABB_BALANCE|00
0,AAA None]||||ABB_BALANCE|99999999
0,AAA None]||||ABB_BALANCE|00
1463.49,AAA None]||||ABB_BALANCE|1463.491463.49
1463.49,AAA None]||||ABB_BALANCE|1463.491463.49

 

Thank you

3 REPLIES 3
smoosh
8 - Asteroid

I'm sure someone will post a better answer, but give the attached workflow a shot. It works correctly on your sample data. 

 

Also, I find this site a great resource for playing with RegEx, and getting a better understanding of what it's doing and why. 

 

https://regex101.com/

 

Good luck. 

alisonpitt
11 - Bolide

I'd go with parsing using this expression: .*\|(.*)$. That'll just grab everything between the last "|" and the end of the string.

 

I second the recommendation for regex101.com - it's the best resource for learning and testing regex!

alisonpitt_0-1685665055535.png

 

acarter881
12 - Quasar

Hello, @rajputakansha.

 

Please see the attached workflow.

 

I believe this RegEx will work for you: ([^|]*)$

 

acarter881_0-1685666792690.png

 

Labels