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

Filter string data for matching currencies

HomesickSurfer
12 - Quasar

All;

 

Is there a better way to filter probable scenarios having Canadian currency with CAD, CDN or C$ attached to or detached from the numeral, each with either a leading space or numeral, and; trailing space, numeral, period or comma?  This should capture all and omit possible false positives capturing additional words containing CAD or CDN such as decade, academy, incommunicado, etc..

 

REGEX_CountMatches([Event Options1], " "+"CAD"+" "+'\d') OR

REGEX_CountMatches([Event Options1], " "+"CAD"+'\d') OR

REGEX_CountMatches([Event Options1], '\d'+" "+"CAD"+" ") OR

REGEX_CountMatches([Event Options1], '\d'+" "+"CAD"+".") OR

REGEX_CountMatches([Event Options1], '\d'+" "+"CAD"+",") OR

REGEX_CountMatches([Event Options1], '\d'+"CAD"+" ") OR

REGEX_CountMatches([Event Options1], '\d'+"CAD"+".") OR

REGEX_CountMatches([Event Options1], '\d'+"CAD"+",") OR

 

REGEX_CountMatches([Event Options1], " "+"CDN"+" "+'\d') OR

REGEX_CountMatches([Event Options1], " "+"CDN"+'\d') OR

REGEX_CountMatches([Event Options1], '\d'+" "+"CDN"+" ") OR

REGEX_CountMatches([Event Options1], '\d'+" "+"CDN"+".") OR

REGEX_CountMatches([Event Options1], '\d'+" "+"CDN"+",") OR

REGEX_CountMatches([Event Options1], '\d'+"CDN"+" ") OR

REGEX_CountMatches([Event Options1], '\d'+"CDN"+".") OR

REGEX_CountMatches([Event Options1], '\d'+"CDN"+",") OR

 

REGEX_CountMatches([Event Options1], " "+"C\$"+" "+'\d') OR

REGEX_CountMatches([Event Options1], " "+"C\$"+'\d') OR

REGEX_CountMatches([Event Options1], '\d'+" "+"C\$"+" ") OR

REGEX_CountMatches([Event Options1], '\d'+" "+"C\$"+".") OR

REGEX_CountMatches([Event Options1], '\d'+" "+"C\$"+",") OR

REGEX_CountMatches([Event Options1], '\d'+"C\$"+" ") OR

REGEX_CountMatches([Event Options1], '\d'+"C\$"+".") OR

REGEX_CountMatches([Event Options1], '\d'+"C\$"+",")

 

Scenarios:

 

RECEIVE CAD 1.00

RECEIVE CAD1.00

RECEIVE 1.00 CAD IN

RECEIVE 1.00 CAD.

RECEIVE 1.00 CAD, AND;

RECEIVE 1.00CAD IN

RECEIVE 1.00CAD.

RECEIVE 1.00CAD, AND;

 

RECEIVE CDN 1.00

RECEIVE CDN1.00

RECEIVE 1.00 CDN IN

RECEIVE 1.00 CDN.

RECEIVE 1.00 CDN, AND;

RECEIVE 1.00CDN IN

RECEIVE 1.00CDN.

RECEIVE 1.00CDN, AND;

 

RECEIVE C$ 1.00

RECEIVE C$1.00

RECEIVE 1.00 C$ IN

RECEIVE 1.00 C$.

RECEIVE 1.00 C$, AND;

RECEIVE 1.00C$ IN

RECEIVE 1.00C$.

RECEIVE 1.00C$, AND;

2 REPLIES 2
Felipe_Ribeir0
16 - Nebula

Hi @HomesickSurfer 

 

Try this expression

REGEX_CountMatches([Field1], '(\d{1,}|\s{1,})(CAD|C\$|CDN)(\d{1,}|\s{1,}|\.{1,}|\,{1,})')

 

Felipe_Ribeir0_0-1673379143034.png

 

HomesickSurfer
12 - Quasar

Hi @Felipe_Ribeir0 

 

Awesome!  Many thx!  Works very well and it also filters out potential O's for 0's and duplicate $ symbols, etc.  THANK YOU

 

RECEIVE 1.0OCDN IN
RECEIVE 1.00C$$

Labels
Top Solution Authors