Alteryx Designer Discussions

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

Regex_match

Alteryx Partner

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

Alteryx Certified Partner
Alteryx Certified Partner

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,

Alteryx Certified Partner
Alteryx Certified Partner
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 reboot. Order shall return.
17 - Castor
17 - Castor

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