Alteryx Designer Desktop Discussions

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

RegEx - Extract a Variable Dollar Value N Characters from a Given Word

hellyars
13 - Pulsar

I tried this once before.  I took it down by "solving it", but it was not solved.  It was a hot mess.  I now better understand what I need.

 

I need to extract the dollar value of the string value that is immediately N characters from the word "awarded."  The string value will be >$1,000,000.  The text may include other values, but I only want to extract the first string value immediately N characters from "awarded."  

 

I do not know how to adjust for the variability in the number of characters or in the value of the award nor how to convert it to a dollar value from a string. 

 

I know it has to start. ^.*\bawarded\s. ...

 

Examples

 

Lorem ipsum dolor sit amet, consectetur adipiscing awarded an $8,069,336 elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Augue eget arcu dictum varius duis at consectetur lorem donec. Nunc scelerisque viverra mauris $28,069,336 in aliquam sem fringilla. 

 OR something like this

Lorem ipsum dolor sit amet, consectetur adipiscing awarded to my best friend $9,998,069,336 elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Augue eget arcu dictum varius duis at consectetur lorem donec. Nunc scelerisque viverra mauris $28,069,336 in aliquam sem fringilla.

THANKS!

12 REPLIES 12
hellyars
13 - Pulsar

@Thableaus 

 

I like where you are going with this approach. But, I ran into a snag when I tested it out using regex101.com.  It does not seem to be locking onto the first awarded value pair. 

 

Screen Shot 2019-02-26 at 12.44.54 PM.png

Thableaus
17 - Castor
17 - Castor

@hellyars 

 

Maybe this would work:

 

^.*?awarded.*?\$([\d,]+).*$

 

Cheers,

hellyars
13 - Pulsar

It works -- nice and simple.  Thanks.

Labels