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

Alteryx Designer Desktop Discussions

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

RegEx to Parse Out Digits

knnwndlm
8 - Asteroid

Hi SME,

 

In the attachment, I have a dataset where column C (Value) has a bunch of string with embedded digits.  All my rows have embedded digits at the end except rows 155 and 156 where the numbers are embedded in between the pipes ("|").  

 

This is the RegEx that I used to peel the number at the end:  (\d+$).  How can I modify this so that any rows such 3 or 4 would pick up 1.000000 in the RegEx output and for rows 155/156,  would yield the numbers embedded in between the pipes (196266 and 1.000000, respectively)?  I've fixed the problem using the Formula tool right after the RegEx too.  I would like to see if it's possible to avert the Formula tool in this case with the right RegEx script.

 

Thanks,

kwl

13 REPLIES 13
knnwndlm
8 - Asteroid

@binuacs - Many thanks! 

knnwndlm
8 - Asteroid

@binuacs - Is it possible to combine the last two elements together into one "\?.*" instead of "\s?.*" at the end of the script

".*(\$[0-9,]*\.?[0-9]{0,2})\s?.*"?  Just thought the period would cover the space character as well. 

binuacs
21 - Polaris

@knnwndlm Just try from your end , changing the regex sequence might affect your end result, but you can play with the regex and let me know if you see any issues.

knnwndlm
8 - Asteroid

@binuacs - Why am I unable to use ".\s+(\d+).\s+" in the RegEx Tool to peel out only the number in a string?  Kept getting no output.

Labels