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_match

TrucT_experian
5 - Atom

Need a quick simple regex_match solution

  1. E
  2. L,D,D
  3. H
  4. A,A,A,A,A,A,A,A

 

need 2 and 3 to be "False" and 1 and 4 to be "True".  Having some issue with the ","

 

if REGEX_Match([TEST],'A-D') then "True" else "False" endif

3 REPLIES 3
Thableaus
17 - Castor
17 - Castor

Hi @TrucT_experian 

 

Could you please give us more details on what your desired output is?

 

Do you need to flag records that contain only letters from A to D? Is that what you need?

 

Cheers,

MarqueeCrew
20 - Arcturus
20 - Arcturus
How about contains?

Contains([test],"A") OR
Contains([test],"B") OR
Contains([test],"C") OR
Contains([test],"D")

Cheers,

Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
danilang
19 - Altair
19 - Altair

Hi @TrucT_experian 

 

This one will match your criteria

if REGEX_Match([TEST],'.*[A-D].*') then "True" else "False" endif

 

 

This is an interesting case.  It appears that regex_match and regex_replace act in slightly different ways.  Here's the test I set up 

 

formulas.png

 

First formula is the original.  The second, a replace using the same regex as the first. The 3rd one expands the expression to match the entire field.

 

And here are the results

 

Results.png

 

If appears that Regex_Match has to match the entire field in order to return true, whereas Regex_replace acts on any part of the field.  

 

 

 

Dan

 

 

 

 

Labels