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

REGEX_MATCH

rneco
5 - Atom

Hello,

 

New to Alteryx, please see sample data attached. I am trying to produce a REGEX match based on values in the location column and looking for similar results seen in the match column. I am trying to match by any word/s separated by a comma, regardless if the words before the comma contains a space or not. I either get half the intended results or all true or all false. It seems this should be simple but I can't quite figure it out.  Any input is greatly appreciated!

7 REPLIES 7
MatthewBr
Alteryx Alumni (Retired)

I think you need to explain this a little more  - For example:  What are you matching the cell with RIVER to? or LAKE to? 

Location
River
Lake
MatthewBr
Alteryx Alumni (Retired)

@rneco 

oly
Alteryx Alumni (Retired)

Hi @rneco ,

I think I understand what you are trying to achieve comparing experssions between commas.

 

The problem is you need to tell REGEX a very general expression for example anything before first comma plus comma would be "(.*?)\,". You can't tell it find "Lake and River" and then compare with "River and Lake". I would just use simple Text to column and then formula to compare results Column1 and 2 and 3 if necessary. You can do something more fancy if you have unlimited combinations.

You could also add parsing by space and "and"  within the comma groups if "Lake and River" should be same as "River and Lake".

Best of luck with your workflows,

Oly

rneco
5 - Atom

Hello MattewBr,

 

Thanks for your response. River or Lake is not being matched to anything. Any value in the location column that does not contain a comma is not supposed to be matched to anything. Some values are one word and some are more than one with no commas. I was hoping REGEX had  a way of matching by a word or words separated by a comma.

rneco
5 - Atom

Hello oly,

 

I have an unlimited number of combinations so I might have to take another route. Thanks for your help.

Luke_C
17 - Castor
17 - Castor

Hi @rneco 

 

Maybe something like this?

 

  1. Assign record ID
  2. Split to rows based on commas
  3. Count distinct location values per record ID
  4. Join count back to data
  5. Anything with more than 1 unique location is FALSE, otherwise TRUE

 

Luke_C_0-1651081080560.png

 

 

rneco
5 - Atom

Hello Luke_C,

 

This worked perfectly! Thank a lot!

Labels
Top Solution Authors