Free Trial

Alteryx Designer Desktop Discussions

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

Regex formula issue

Carlyn
8 - Asteroid

Hi

I am trying to use a Regex formula to return a result based on certain text being included in a text string,

The formula I am using is 

 

if REGEX_Match ([Subject], "DTDF\s\D.*") then
"DTDF"
Else
"[Area]"
endif 

 

Data

SubjectReceivedSizeArea
DTDF Assignment09/10/202450 KBDTDF
DTDF Assignment27/09/2024111 KBDTDF
DTDF Assignment08/10/202491 KBDTDF
CBSI DTDF11/10/2024306 KBEMEA

 

 

However, this is only working if DTDF is at the beginning of the string and not when it is within the string.

Can someone tell me how to amend the formula so it will work for all rows that include this text please?

 

 

2 REPLIES 2
ShankerV
17 - Castor

Hi @Carlyn 

 

Are you expecting output like this...

 

Screenshot 2024-11-22 150142.jpg

 

if contains([Subject],"DTDF")
then "DTDF"
Else [Area]
endif

 

Many thanks

Shanker V

Carlyn
8 - Asteroid

yes! that was simpler than I thought. Thank you!

Labels
Top Solution Authors